index.vue 73 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125
  1. <template>
  2. <div>
  3. <page-metadata
  4. v-if="exists && !loading"
  5. :title="`${station.displayName}`"
  6. />
  7. <page-metadata v-else-if="!exists && !loading" :title="`Not found`" />
  8. <div id="page-loader-container" v-if="loading">
  9. <content-loader
  10. width="1920"
  11. height="1080"
  12. :primary-color="nightmode ? '#222' : '#fff'"
  13. :secondary-color="nightmode ? '#444' : '#ddd'"
  14. preserve-aspect-ratio="none"
  15. id="page-loader-content"
  16. >
  17. <rect x="55" y="105" rx="5" ry="5" width="670" height="149" />
  18. <rect x="55" y="283" rx="5" ry="5" width="670" height="640" />
  19. <rect x="745" y="108" rx="5" ry="5" width="1120" height="672" />
  20. <rect x="745" y="810" rx="5" ry="5" width="1120" height="110" />
  21. </content-loader>
  22. <content-loader
  23. width="1920"
  24. height="1080"
  25. :primary-color="nightmode ? '#222' : '#fff'"
  26. :secondary-color="nightmode ? '#444' : '#ddd'"
  27. preserve-aspect-ratio="none"
  28. id="page-loader-layout"
  29. >
  30. <rect x="0" y="0" rx="0" ry="0" width="1920" height="64" />
  31. <rect x="0" y="980" rx="0" ry="0" width="1920" height="100" />
  32. </content-loader>
  33. </div>
  34. <!-- More simplistic loading animation for mobile users -->
  35. <div v-show="loading" id="mobile-progress-animation" />
  36. <ul
  37. v-if="
  38. currentSong &&
  39. (currentSong.youtubeId === 'l9PxOanFjxQ' ||
  40. currentSong.youtubeId === 'xKVcVSYmesU' ||
  41. currentSong.youtubeId === '60ItHLz5WEA' ||
  42. currentSong.youtubeId === 'e6vkFbtSGm0')
  43. "
  44. class="bg-bubbles"
  45. >
  46. <li></li>
  47. <li></li>
  48. <li></li>
  49. <li></li>
  50. <li></li>
  51. <li></li>
  52. <li></li>
  53. <li></li>
  54. <li></li>
  55. <li></li>
  56. </ul>
  57. <div v-show="!loading && exists">
  58. <main-header />
  59. <div id="station-outer-container">
  60. <div
  61. id="station-inner-container"
  62. :class="{ 'nothing-here': noSong }"
  63. >
  64. <div id="station-left-column" class="column">
  65. <div id="about-station-container" class="quadrant">
  66. <div id="station-info">
  67. <div class="row" id="station-name">
  68. <h1>{{ station.displayName }}</h1>
  69. <i
  70. v-if="station.type === 'official'"
  71. class="material-icons verified-station"
  72. content="Verified Station"
  73. v-tippy
  74. >
  75. check_circle
  76. </i>
  77. <a>
  78. <!-- Favorite Station Button -->
  79. <i
  80. v-if="
  81. loggedIn && station.isFavorited
  82. "
  83. @click.prevent="unfavoriteStation()"
  84. content="Unfavorite Station"
  85. v-tippy
  86. class="material-icons"
  87. >star</i
  88. >
  89. <i
  90. v-if="
  91. loggedIn && !station.isFavorited
  92. "
  93. @click.prevent="favoriteStation()"
  94. class="material-icons"
  95. content="Favorite Station"
  96. v-tippy
  97. >star_border</i
  98. >
  99. </a>
  100. <i
  101. class="material-icons stationMode"
  102. :content="
  103. station.partyMode
  104. ? 'Station in Party mode'
  105. : 'Station in Playlist mode'
  106. "
  107. v-tippy="{ theme: 'info' }"
  108. >{{
  109. station.partyMode
  110. ? "emoji_people"
  111. : "playlist_play"
  112. }}</i
  113. >
  114. </div>
  115. <p>{{ station.description }}</p>
  116. </div>
  117. <div id="admin-buttons" v-if="isOwnerOrAdmin()">
  118. <!-- (Admin) Pause/Resume Button -->
  119. <button
  120. class="button is-danger"
  121. v-if="stationPaused"
  122. @click="resumeStation()"
  123. >
  124. <i class="material-icons icon-with-button"
  125. >play_arrow</i
  126. >
  127. <span> Resume Station </span>
  128. </button>
  129. <button
  130. class="button is-danger"
  131. @click="pauseStation()"
  132. v-else
  133. >
  134. <i class="material-icons icon-with-button"
  135. >pause</i
  136. >
  137. <span> Pause Station </span>
  138. </button>
  139. <!-- (Admin) Skip Button -->
  140. <button
  141. class="button is-danger"
  142. @click="skipStation()"
  143. >
  144. <i class="material-icons icon-with-button"
  145. >skip_next</i
  146. >
  147. <span> Force Skip </span>
  148. </button>
  149. <!-- (Admin) Station Settings Button -->
  150. <button
  151. class="button is-primary"
  152. @click="openModal('manageStation')"
  153. >
  154. <i class="material-icons icon-with-button"
  155. >settings</i
  156. >
  157. <span> Manage Station </span>
  158. </button>
  159. </div>
  160. </div>
  161. <div id="sidebar-container" class="quadrant">
  162. <station-sidebar />
  163. </div>
  164. </div>
  165. <div id="station-right-column" class="column">
  166. <div class="player-container quadrant" v-show="!noSong">
  167. <div id="video-container">
  168. <div
  169. id="stationPlayer"
  170. style="
  171. width: 100%;
  172. height: 100%;
  173. min-height: 200px;
  174. "
  175. />
  176. <div
  177. class="player-cannot-autoplay"
  178. v-if="!canAutoplay"
  179. @click="
  180. increaseVolume() && decreaseVolume()
  181. "
  182. >
  183. <p>
  184. Please click anywhere on the screen for
  185. the video to start
  186. </p>
  187. </div>
  188. </div>
  189. <div id="seeker-bar-container">
  190. <div
  191. id="seeker-bar"
  192. :class="{
  193. 'christmas-seeker': christmas,
  194. nyan:
  195. currentSong &&
  196. currentSong.youtubeId ===
  197. 'QH2-TGUlwu4'
  198. }"
  199. />
  200. <div
  201. class="seeker-bar-cover"
  202. :style="{
  203. width: `calc(100% - ${seekerbarPercentage}%)`
  204. }"
  205. ></div>
  206. <img
  207. v-if="
  208. currentSong &&
  209. currentSong.youtubeId === 'QH2-TGUlwu4'
  210. "
  211. src="https://freepngimg.com/thumb/nyan_cat/1-2-nyan-cat-free-download-png.png"
  212. :style="{
  213. position: 'absolute',
  214. top: `-10px`,
  215. left: `${seekerbarPercentage}%`,
  216. width: '50px'
  217. }"
  218. />
  219. <img
  220. v-if="
  221. currentSong &&
  222. (currentSong.youtubeId ===
  223. 'DtVBCG6ThDk' ||
  224. currentSong.youtubeId ===
  225. 'sI66hcu9fIs' ||
  226. currentSong.youtubeId ===
  227. 'iYYRH4apXDo' ||
  228. currentSong.youtubeId ===
  229. 'tRcPA7Fzebw')
  230. "
  231. src="/assets/rocket.svg"
  232. :style="{
  233. position: 'absolute',
  234. top: `-21px`,
  235. left: `calc(${seekerbarPercentage}% - 35px)`,
  236. width: '50px',
  237. transform: 'rotate(45deg)'
  238. }"
  239. />
  240. <img
  241. v-if="
  242. currentSong &&
  243. currentSong.youtubeId === 'jofNR_WkoCE'
  244. "
  245. src="/assets/fox.svg"
  246. :style="{
  247. position: 'absolute',
  248. top: `-21px`,
  249. left: `calc(${seekerbarPercentage}% - 35px)`,
  250. width: '50px',
  251. transform: 'scaleX(-1)',
  252. opacity: 1
  253. }"
  254. />
  255. <img
  256. v-if="
  257. currentSong &&
  258. (currentSong.youtubeId ===
  259. 'l9PxOanFjxQ' ||
  260. currentSong.youtubeId ===
  261. 'xKVcVSYmesU' ||
  262. currentSong.youtubeId ===
  263. '60ItHLz5WEA' ||
  264. currentSong.youtubeId ===
  265. 'e6vkFbtSGm0')
  266. "
  267. src="/assets/old_logo.png"
  268. :style="{
  269. position: 'absolute',
  270. top: `-9px`,
  271. left: `calc(${seekerbarPercentage}% - 22px)`,
  272. 'background-color': 'rgb(96, 199, 169)',
  273. width: '25px',
  274. height: '25px',
  275. 'border-radius': '25px'
  276. }"
  277. />
  278. <img
  279. v-if="
  280. christmas &&
  281. currentSong &&
  282. ![
  283. 'QH2-TGUlwu4',
  284. 'DtVBCG6ThDk',
  285. 'sI66hcu9fIs',
  286. 'iYYRH4apXDo',
  287. 'tRcPA7Fzebw',
  288. 'jofNR_WkoCE',
  289. 'l9PxOanFjxQ',
  290. 'xKVcVSYmesU',
  291. '60ItHLz5WEA',
  292. 'e6vkFbtSGm0'
  293. ].includes(currentSong.youtubeId)
  294. "
  295. src="/assets/santa.png"
  296. :style="{
  297. position: 'absolute',
  298. top: `-30px`,
  299. left: `calc(${seekerbarPercentage}% - 25px)`,
  300. height: '50px',
  301. transform: 'scaleX(-1)'
  302. }"
  303. />
  304. </div>
  305. <div id="control-bar-container">
  306. <div id="left-buttons">
  307. <!-- Debug Box -->
  308. <button
  309. v-if="frontendDevMode === 'development'"
  310. class="button is-primary"
  311. @click="togglePlayerDebugBox()"
  312. @dblclick="resetPlayerDebugBox()"
  313. content="Debug"
  314. v-tippy
  315. >
  316. <i
  317. class="material-icons icon-with-button"
  318. >
  319. bug_report
  320. </i>
  321. </button>
  322. <!-- Local Pause/Resume Button -->
  323. <button
  324. class="button is-primary"
  325. @click="resumeLocalStation()"
  326. id="local-resume"
  327. v-if="localPaused"
  328. content="Unpause Playback"
  329. v-tippy
  330. >
  331. <i class="material-icons">play_arrow</i>
  332. </button>
  333. <button
  334. class="button is-primary"
  335. @click="pauseLocalStation()"
  336. id="local-pause"
  337. v-else
  338. content="Pause Playback"
  339. v-tippy
  340. >
  341. <i class="material-icons">pause</i>
  342. </button>
  343. <!-- Vote to Skip Button -->
  344. <button
  345. v-if="!skipVotesLoaded"
  346. class="button is-primary disabled"
  347. content="Skip votes have not been loaded yet"
  348. v-tippy
  349. >
  350. <i
  351. class="material-icons icon-with-button"
  352. >skip_next</i
  353. >
  354. </button>
  355. <button
  356. v-else-if="loggedIn"
  357. class="button is-primary"
  358. @click="voteSkipStation()"
  359. content="Vote to Skip Song"
  360. v-tippy
  361. >
  362. <i
  363. class="material-icons icon-with-button"
  364. >skip_next</i
  365. >
  366. {{ currentSong.skipVotes }}
  367. </button>
  368. <button
  369. v-else
  370. class="button is-primary disabled"
  371. content="Log in to vote to skip songs"
  372. v-tippy="{ theme: 'info' }"
  373. >
  374. <i
  375. class="material-icons icon-with-button"
  376. >skip_next</i
  377. >
  378. {{ currentSong.skipVotes }}
  379. </button>
  380. </div>
  381. <div id="duration">
  382. <p>
  383. {{ timeElapsed }} /
  384. {{
  385. utils.formatTime(
  386. currentSong.duration
  387. )
  388. }}
  389. </p>
  390. </div>
  391. <p id="volume-control" v-if="!isApple">
  392. <i
  393. v-if="muted"
  394. class="material-icons"
  395. @click="toggleMute()"
  396. content="Unmute"
  397. v-tippy
  398. >volume_mute</i
  399. >
  400. <i
  401. v-else
  402. class="material-icons"
  403. @click="toggleMute()"
  404. content="Mute"
  405. v-tippy
  406. >volume_down</i
  407. >
  408. <input
  409. v-model="volumeSliderValue"
  410. type="range"
  411. min="0"
  412. max="10000"
  413. class="volume-slider active"
  414. @change="changeVolume()"
  415. @input="changeVolume()"
  416. />
  417. <i
  418. class="material-icons"
  419. @click="increaseVolume()"
  420. content="Increase Volume"
  421. v-tippy
  422. >volume_up</i
  423. >
  424. </p>
  425. <div id="right-buttons" v-if="loggedIn">
  426. <!-- Ratings (Like/Dislike) Buttons -->
  427. <div
  428. id="ratings"
  429. v-if="ratingsLoaded && ownRatingsLoaded"
  430. :class="{
  431. liked: currentSong.liked,
  432. disliked: currentSong.disliked
  433. }"
  434. >
  435. <!-- Like Song Button -->
  436. <button
  437. class="button is-success like-song"
  438. id="like-song"
  439. @click="toggleLike()"
  440. content="Like Song"
  441. v-tippy
  442. >
  443. <i
  444. class="material-icons icon-with-button"
  445. :class="{
  446. liked: currentSong.liked
  447. }"
  448. >thumb_up_alt</i
  449. >{{ currentSong.likes }}
  450. </button>
  451. <!-- Dislike Song Button -->
  452. <button
  453. class="button is-danger dislike-song"
  454. id="dislike-song"
  455. @click="toggleDislike()"
  456. content="Dislike Song"
  457. v-tippy
  458. >
  459. <i
  460. class="material-icons icon-with-button"
  461. :class="{
  462. disliked:
  463. currentSong.disliked
  464. }"
  465. >thumb_down_alt</i
  466. >{{ currentSong.dislikes }}
  467. </button>
  468. </div>
  469. <div id="ratings" class="disabled" v-else>
  470. <!-- Like Song Button -->
  471. <button
  472. class="button is-success like-song disabled"
  473. id="like-song"
  474. content="Ratings have not been loaded yet"
  475. v-tippy
  476. >
  477. <i
  478. class="material-icons icon-with-button"
  479. >thumb_up_alt</i
  480. >
  481. </button>
  482. <!-- Dislike Song Button -->
  483. <button
  484. class="button is-danger dislike-song disabled"
  485. id="dislike-song"
  486. content="Ratings have not been loaded yet"
  487. v-tippy
  488. >
  489. <i
  490. class="material-icons icon-with-button"
  491. >thumb_down_alt</i
  492. >
  493. </button>
  494. </div>
  495. <!-- Add Song To Playlist Button & Dropdown -->
  496. <add-to-playlist-dropdown
  497. :song="currentSong"
  498. placement="top-end"
  499. >
  500. <template #button>
  501. <div
  502. id="add-song-to-playlist"
  503. content="Add Song to Playlist"
  504. v-tippy
  505. >
  506. <div class="control has-addons">
  507. <button
  508. class="button is-primary"
  509. >
  510. <i
  511. class="material-icons"
  512. >
  513. playlist_add
  514. </i>
  515. </button>
  516. <button
  517. class="button"
  518. id="dropdown-toggle"
  519. >
  520. <i
  521. class="material-icons"
  522. >
  523. {{
  524. showPlaylistDropdown
  525. ? "expand_more"
  526. : "expand_less"
  527. }}
  528. </i>
  529. </button>
  530. </div>
  531. </div>
  532. </template>
  533. </add-to-playlist-dropdown>
  534. </div>
  535. <div id="right-buttons" v-else>
  536. <!-- Disabled Ratings (Like/Dislike) Buttons -->
  537. <div id="ratings" v-if="ratingsLoaded">
  538. <!-- Disabled Like Song Button -->
  539. <button
  540. class="button is-success disabled"
  541. id="like-song"
  542. content="Log in to like songs"
  543. v-tippy="{ theme: 'info' }"
  544. >
  545. <i
  546. class="material-icons icon-with-button"
  547. >thumb_up_alt</i
  548. >{{ currentSong.likes }}
  549. </button>
  550. <!-- Disabled Dislike Song Button -->
  551. <button
  552. class="button is-danger disabled"
  553. id="dislike-song"
  554. content="Log in to dislike songs"
  555. v-tippy="{ theme: 'info' }"
  556. >
  557. <i
  558. class="material-icons icon-with-button"
  559. >thumb_down_alt</i
  560. >{{ currentSong.dislikes }}
  561. </button>
  562. </div>
  563. <div id="ratings" v-else>
  564. <!-- Disabled Like Song Button -->
  565. <button
  566. class="button is-success disabled"
  567. id="like-song"
  568. content="Ratings have not been loaded yet"
  569. v-tippy="{ theme: 'info' }"
  570. >
  571. <i
  572. class="material-icons icon-with-button"
  573. >thumb_up_alt</i
  574. >
  575. </button>
  576. <!-- Disabled Dislike Song Button -->
  577. <button
  578. class="button is-danger disabled"
  579. id="dislike-song"
  580. content="Ratings have not been loaded yet"
  581. v-tippy="{ theme: 'info' }"
  582. >
  583. <i
  584. class="material-icons icon-with-button"
  585. >thumb_down_alt</i
  586. >
  587. </button>
  588. </div>
  589. <!-- Disabled Add Song To Playlist Button & Dropdown -->
  590. <div id="add-song-to-playlist">
  591. <div class="control has-addons">
  592. <button
  593. class="button is-primary disabled"
  594. content="Log in to add songs to playlist"
  595. v-tippy="{ theme: 'info' }"
  596. >
  597. <i class="material-icons"
  598. >queue</i
  599. >
  600. </button>
  601. </div>
  602. </div>
  603. </div>
  604. </div>
  605. </div>
  606. <p
  607. class="player-container nothing-here-text"
  608. v-if="noSong"
  609. >
  610. No song is currently playing
  611. </p>
  612. <div v-if="!noSong" id="current-next-row">
  613. <div
  614. id="currently-playing-container"
  615. class="quadrant"
  616. :class="{ 'no-currently-playing': noSong }"
  617. >
  618. <song-item
  619. :song="currentSong"
  620. :duration="false"
  621. :requested-by="
  622. station.type === 'community' &&
  623. station.partyMode === true
  624. "
  625. header="Currently Playing.."
  626. />
  627. </div>
  628. <div
  629. v-if="nextSong"
  630. id="next-up-container"
  631. class="quadrant"
  632. >
  633. <song-item
  634. :song="nextSong"
  635. :duration="false"
  636. :requested-by="
  637. station.type === 'community' &&
  638. station.partyMode === true
  639. "
  640. header="Next Up.."
  641. />
  642. </div>
  643. </div>
  644. </div>
  645. </div>
  646. <request-song v-if="modals.requestSong" />
  647. <create-playlist v-if="modals.createPlaylist" />
  648. <manage-station
  649. v-if="modals.manageStation"
  650. :station-id="station._id"
  651. sector="station"
  652. />
  653. <edit-playlist v-if="modals.editPlaylist" />
  654. <edit-song
  655. v-if="modals.editSong"
  656. song-type="songs"
  657. sector="station"
  658. />
  659. <report v-if="modals.report" />
  660. </div>
  661. <main-footer />
  662. </div>
  663. <floating-box id="player-debug-box" ref="playerDebugBox">
  664. <template #body>
  665. <span><b>No song</b>: {{ noSong }}</span>
  666. <span><b>Song id</b>: {{ currentSong._id }}</span>
  667. <span><b>YouTube id</b>: {{ currentSong.youtubeId }}</span>
  668. <span><b>Duration</b>: {{ currentSong.duration }}</span>
  669. <span
  670. ><b>Skip duration</b>: {{ currentSong.skipDuration }}</span
  671. >
  672. <span><b>Loading</b>: {{ loading }}</span>
  673. <span><b>Can autoplay</b>: {{ canAutoplay }}</span>
  674. <span><b>Player ready</b>: {{ playerReady }}</span>
  675. <span
  676. ><b>Attempts to play video</b>:
  677. {{ attemptsToPlayVideo }}</span
  678. >
  679. <span
  680. ><b>Last time requested if can autoplay</b>:
  681. {{ lastTimeRequestedIfCanAutoplay }}</span
  682. >
  683. <span><b>Seeking</b>: {{ seeking }}</span>
  684. <span><b>Playback rate</b>: {{ playbackRate }}</span>
  685. <span><b>System difference</b>: {{ systemDifference }}</span>
  686. <span><b>Time before paused</b>: {{ timeBeforePause }}</span>
  687. <span><b>Time paused</b>: {{ timePaused }}</span>
  688. <span><b>Time elapsed</b>: {{ timeElapsed }}</span>
  689. <span><b>Volume slider value</b>: {{ volumeSliderValue }}</span>
  690. <span><b>Local paused</b>: {{ localPaused }}</span>
  691. <span><b>Station paused</b>: {{ stationPaused }}</span>
  692. <span
  693. ><b>Party playlists selected</b>: {{ partyPlaylists }}</span
  694. >
  695. <span><b>Skip votes loaded</b>: {{ skipVotesLoaded }}</span>
  696. <span
  697. ><b>Skip votes current</b>:
  698. {{
  699. currentSong.skipVotesCurrent === true ||
  700. currentSong.skipVotesCurrent === false
  701. ? currentSong.skipVotesCurrent
  702. : "N/A"
  703. }}</span
  704. >
  705. <span
  706. ><b>Skip votes</b>:
  707. {{ skipVotesLoaded ? currentSong.skipVotes : "N/A" }}</span
  708. >
  709. <span><b>Ratings loaded</b>: {{ ratingsLoaded }}</span>
  710. <span
  711. ><b>Ratings</b>:
  712. {{
  713. ratingsLoaded
  714. ? `${currentSong.likes} / ${currentSong.dislikes}`
  715. : "N/A"
  716. }}</span
  717. >
  718. <span><b>Own ratings loaded</b>: {{ ownRatingsLoaded }}</span>
  719. <span
  720. ><b>Own ratings</b>:
  721. {{
  722. ownRatingsLoaded
  723. ? `${currentSong.liked} / ${currentSong.disliked}`
  724. : "N/A"
  725. }}</span
  726. >
  727. </template>
  728. </floating-box>
  729. <floating-box
  730. id="keyboardShortcutsHelper"
  731. ref="keyboardShortcutsHelper"
  732. >
  733. <template #body>
  734. <div>
  735. <div v-if="isOwnerOrAdmin()">
  736. <span class="biggest"><b>Admin/owner</b></span>
  737. <span><b>Ctrl + Space</b> - Pause/resume station</span>
  738. <span><b>Ctrl + Numpad right</b> - Skip station</span>
  739. </div>
  740. <hr v-if="isOwnerOrAdmin()" />
  741. <div>
  742. <span class="biggest"><b>Volume</b></span>
  743. <span
  744. ><b>Ctrl + Numpad up/down</b> - Volume up/down
  745. 10%</span
  746. >
  747. <span
  748. ><b>Ctrl + Shift + Numpad up/down</b> - Volume
  749. up/down 10%</span
  750. >
  751. </div>
  752. <hr />
  753. <div>
  754. <span class="biggest"><b>Misc</b></span>
  755. <span><b>Ctrl + D</b> - Toggles debug box</span>
  756. <span><b>Ctrl + Shift + D</b> - Resets debug box</span>
  757. <span
  758. ><b>Ctrl + /</b> - Toggles keyboard shortcuts
  759. box</span
  760. >
  761. <span
  762. ><b>Ctrl + Shift + /</b> - Resets keyboard shortcuts
  763. box</span
  764. >
  765. </div>
  766. </div>
  767. </template>
  768. </floating-box>
  769. <Z404 v-if="!exists"></Z404>
  770. </div>
  771. </template>
  772. <script>
  773. import { mapState, mapActions, mapGetters } from "vuex";
  774. import { defineAsyncComponent } from "vue";
  775. import Toast from "toasters";
  776. import { ContentLoader } from "vue-content-loader";
  777. import canAutoPlay from "can-autoplay";
  778. import aw from "@/aw";
  779. import ms from "@/ms";
  780. import ws from "@/ws";
  781. import keyboardShortcuts from "@/keyboardShortcuts";
  782. import MainHeader from "@/components/layout/MainHeader.vue";
  783. import MainFooter from "@/components/layout/MainFooter.vue";
  784. import FloatingBox from "@/components/FloatingBox.vue";
  785. import AddToPlaylistDropdown from "@/components/AddToPlaylistDropdown.vue";
  786. import SongItem from "@/components/SongItem.vue";
  787. import Z404 from "../404.vue";
  788. import utils from "../../../js/utils";
  789. import StationSidebar from "./Sidebar/index.vue";
  790. export default {
  791. components: {
  792. ContentLoader,
  793. MainHeader,
  794. MainFooter,
  795. RequestSong: defineAsyncComponent(() =>
  796. import("@/components/modals/RequestSong.vue")
  797. ),
  798. EditPlaylist: defineAsyncComponent(() =>
  799. import("@/components/modals/EditPlaylist")
  800. ),
  801. CreatePlaylist: defineAsyncComponent(() =>
  802. import("@/components/modals/CreatePlaylist.vue")
  803. ),
  804. ManageStation: defineAsyncComponent(() =>
  805. import("@/components/modals/ManageStation/index.vue")
  806. ),
  807. Report: defineAsyncComponent(() =>
  808. import("@/components/modals/Report.vue")
  809. ),
  810. Z404,
  811. FloatingBox,
  812. StationSidebar,
  813. AddToPlaylistDropdown,
  814. EditSong: defineAsyncComponent(() =>
  815. import("@/components/modals/EditSong")
  816. ),
  817. SongItem
  818. },
  819. data() {
  820. return {
  821. utils,
  822. isApple:
  823. navigator.platform.match(/iPhone|iPod|iPad/) ||
  824. navigator.vendor === "Apple Computer, Inc.",
  825. title: "Station",
  826. loading: true,
  827. exists: true,
  828. playerReady: false,
  829. player: undefined,
  830. timePaused: 0,
  831. muted: false,
  832. timeElapsed: "0:00",
  833. timeBeforePause: 0,
  834. systemDifference: 0,
  835. attemptsToPlayVideo: 0,
  836. canAutoplay: true,
  837. lastTimeRequestedIfCanAutoplay: 0,
  838. seeking: false,
  839. playbackRate: 1,
  840. volumeSliderValue: 0,
  841. showPlaylistDropdown: false,
  842. theme: "var(--primary-color)",
  843. seekerbarPercentage: 0,
  844. frontendDevMode: "production",
  845. activityWatchVideoDataInterval: null,
  846. activityWatchVideoLastStatus: "",
  847. activityWatchVideoLastYouTubeId: "",
  848. activityWatchVideoLastStartDuration: "",
  849. nextCurrentSong: null,
  850. editSongModalWatcher: null,
  851. beforeEditSongModalLocalPaused: null,
  852. socketConnected: null,
  853. persistentToastCheckerInterval: null,
  854. persistentToasts: [],
  855. partyPlaylistLock: false,
  856. mediasession: false,
  857. christmas: false
  858. };
  859. },
  860. computed: {
  861. skipVotesLoaded() {
  862. return (
  863. !this.noSong &&
  864. Number.isInteger(this.currentSong.skipVotes) &&
  865. this.currentSong.skipVotes >= 0
  866. );
  867. },
  868. ratingsLoaded() {
  869. return (
  870. !this.noSong &&
  871. Number.isInteger(this.currentSong.likes) &&
  872. Number.isInteger(this.currentSong.dislikes) &&
  873. this.currentSong.likes >= 0 &&
  874. this.currentSong.dislikes >= 0
  875. );
  876. },
  877. ownRatingsLoaded() {
  878. return (
  879. !this.noSong &&
  880. typeof this.currentSong.liked === "boolean" &&
  881. typeof this.currentSong.disliked === "boolean"
  882. );
  883. },
  884. aModalIsOpen() {
  885. return Object.keys(this.currentlyActive).length > 0;
  886. },
  887. currentUserQueueSongs() {
  888. return this.songsList.filter(
  889. queueSong => queueSong.requestedBy === this.userId
  890. ).length;
  891. },
  892. ...mapState("modalVisibility", {
  893. modals: state => state.modals,
  894. currentlyActive: state => state.currentlyActive
  895. }),
  896. ...mapState("modals/editSong", {
  897. video: state => state.video
  898. }),
  899. ...mapState("station", {
  900. station: state => state.station,
  901. currentSong: state => state.currentSong,
  902. nextSong: state => state.nextSong,
  903. songsList: state => state.songsList,
  904. stationPaused: state => state.stationPaused,
  905. localPaused: state => state.localPaused,
  906. noSong: state => state.noSong,
  907. partyPlaylists: state => state.partyPlaylists,
  908. includedPlaylists: state => state.includedPlaylists,
  909. excludedPlaylists: state => state.excludedPlaylists
  910. }),
  911. ...mapState({
  912. loggedIn: state => state.user.auth.loggedIn,
  913. userId: state => state.user.auth.userId,
  914. role: state => state.user.auth.role,
  915. nightmode: state => state.user.preferences.nightmode,
  916. autoSkipDisliked: state => state.user.preferences.autoSkipDisliked
  917. }),
  918. ...mapGetters({
  919. socket: "websockets/getSocket"
  920. })
  921. },
  922. async mounted() {
  923. this.editSongModalWatcher = this.$store.watch(
  924. state => state.modals.editSong.video.paused,
  925. paused => {
  926. if (paused && !this.beforeEditSongModalLocalPaused) {
  927. this.resumeLocalStation();
  928. } else if (!paused) {
  929. this.beforeEditSongModalLocalPaused = this.localPaused;
  930. this.pauseLocalStation();
  931. }
  932. }
  933. );
  934. window.scrollTo(0, 0);
  935. Date.currently = () => new Date().getTime() + this.systemDifference;
  936. this.stationIdentifier = this.$route.params.id;
  937. window.stationInterval = 0;
  938. this.activityWatchVideoDataInterval = setInterval(() => {
  939. this.sendActivityWatchVideoData();
  940. }, 1000);
  941. this.persistentToastCheckerInterval = setInterval(() => {
  942. this.persistentToasts.filter(
  943. persistentToast => !persistentToast.checkIfCanRemove()
  944. );
  945. }, 1000);
  946. if (this.socket.readyState === 1) this.join();
  947. ws.onConnect(() => {
  948. this.socketConnected = true;
  949. clearTimeout(window.stationNextSongTimeout);
  950. this.join();
  951. });
  952. ws.onDisconnect(true, () => {
  953. this.socketConnected = false;
  954. const { currentSong } = this.currentSong;
  955. if (this.nextSong)
  956. this.setNextCurrentSong(
  957. {
  958. currentSong: this.nextSong,
  959. startedAt: Date.now() + this.getTimeRemaining(),
  960. paused: false,
  961. timePaused: 0
  962. },
  963. true
  964. );
  965. else
  966. this.setNextCurrentSong(
  967. {
  968. currentSong: null,
  969. startedAt: 0,
  970. paused: false,
  971. timePaused: 0,
  972. pausedAt: 0
  973. },
  974. true
  975. );
  976. window.stationNextSongTimeout = setTimeout(() => {
  977. if (!this.noSong && this.currentSong._id === currentSong._id)
  978. this.skipSong("window.stationNextSongTimeout 2");
  979. }, this.getTimeRemaining());
  980. });
  981. this.frontendDevMode = await lofig.get("mode");
  982. this.mediasession = await lofig.get("siteSettings.mediasession");
  983. this.christmas = await lofig.get("siteSettings.christmas");
  984. this.socket.dispatch(
  985. "stations.existsByName",
  986. this.stationIdentifier,
  987. res => {
  988. if (res.status === "error" || !res.data.exists) {
  989. // station identifier may be using stationid instead
  990. this.socket.dispatch(
  991. "stations.existsById",
  992. this.stationIdentifier,
  993. res => {
  994. if (res.status === "error" || !res.data.exists) {
  995. this.loading = false;
  996. this.exists = false;
  997. }
  998. }
  999. );
  1000. }
  1001. }
  1002. );
  1003. ms.setListeners(0, {
  1004. play: () => {
  1005. if (this.isOwnerOrAdmin()) this.resumeStation();
  1006. else this.resumeLocalStation();
  1007. },
  1008. pause: () => {
  1009. if (this.isOwnerOrAdmin()) this.pauseStation();
  1010. else this.pauseLocalStation();
  1011. },
  1012. nexttrack: () => {
  1013. if (this.isOwnerOrAdmin()) this.skipStation();
  1014. else this.voteSkipStation();
  1015. }
  1016. });
  1017. this.socket.on("event:station.nextSong", res => {
  1018. const { currentSong, startedAt, paused, timePaused } = res.data;
  1019. this.setCurrentSong({
  1020. currentSong,
  1021. startedAt,
  1022. paused,
  1023. timePaused,
  1024. pausedAt: 0
  1025. });
  1026. });
  1027. this.socket.on("event:station.pause", res => {
  1028. this.pausedAt = res.data.pausedAt;
  1029. this.updateStationPaused(true);
  1030. this.pauseLocalPlayer();
  1031. clearTimeout(window.stationNextSongTimeout);
  1032. });
  1033. this.socket.on("event:station.resume", res => {
  1034. this.timePaused = res.data.timePaused;
  1035. this.updateStationPaused(false);
  1036. if (!this.localPaused) this.resumeLocalPlayer();
  1037. });
  1038. this.socket.on("event:station.deleted", () => {
  1039. window.location.href = "/?msg=The station you were in was deleted.";
  1040. return true;
  1041. });
  1042. this.socket.on("event:song.liked", res => {
  1043. if (!this.noSong) {
  1044. if (res.data.youtubeId === this.currentSong.youtubeId) {
  1045. this.updateCurrentSongRatings(res.data);
  1046. }
  1047. }
  1048. });
  1049. this.socket.on("event:song.disliked", res => {
  1050. if (!this.noSong) {
  1051. if (res.data.youtubeId === this.currentSong.youtubeId) {
  1052. this.updateCurrentSongRatings(res.data);
  1053. }
  1054. }
  1055. });
  1056. this.socket.on("event:song.unliked", res => {
  1057. if (!this.noSong) {
  1058. if (res.data.youtubeId === this.currentSong.youtubeId) {
  1059. this.updateCurrentSongRatings(res.data);
  1060. }
  1061. }
  1062. });
  1063. this.socket.on("event:song.undisliked", res => {
  1064. if (!this.noSong) {
  1065. if (res.data.youtubeId === this.currentSong.youtubeId) {
  1066. this.updateCurrentSongRatings(res.data);
  1067. }
  1068. }
  1069. });
  1070. this.socket.on("event:song.ratings.updated", res => {
  1071. if (!this.noSong) {
  1072. if (res.data.youtubeId === this.currentSong.youtubeId) {
  1073. this.updateOwnCurrentSongRatings(res.data);
  1074. }
  1075. }
  1076. });
  1077. this.socket.on("event:station.queue.updated", res => {
  1078. this.updateSongsList(res.data.queue);
  1079. let nextSong = null;
  1080. if (this.songsList[0])
  1081. nextSong = this.songsList[0].youtubeId
  1082. ? this.songsList[0]
  1083. : null;
  1084. this.updateNextSong(nextSong);
  1085. this.addPartyPlaylistSongToQueue();
  1086. });
  1087. this.socket.on("event:station.queue.song.repositioned", res => {
  1088. this.repositionSongInList(res.data.song);
  1089. let nextSong = null;
  1090. if (this.songsList[0])
  1091. nextSong = this.songsList[0].youtubeId
  1092. ? this.songsList[0]
  1093. : null;
  1094. this.updateNextSong(nextSong);
  1095. });
  1096. this.socket.on("event:station.voteSkipSong", () => {
  1097. if (this.currentSong)
  1098. this.updateCurrentSongSkipVotes({
  1099. skipVotes: this.currentSong.skipVotes + 1,
  1100. skipVotesCurrent: null
  1101. });
  1102. });
  1103. this.socket.on("event:privatePlaylist.selected", res => {
  1104. if (this.station.type === "community")
  1105. this.station.privatePlaylist = res.data.playlistId;
  1106. });
  1107. this.socket.on("event:privatePlaylist.deselected", () => {
  1108. if (this.station.type === "community")
  1109. this.station.privatePlaylist = null;
  1110. });
  1111. this.socket.on("event:station.partyMode.updated", res => {
  1112. if (this.station.type === "community")
  1113. this.station.partyMode = res.data.partyMode;
  1114. });
  1115. this.socket.on("event:station.theme.updated", res => {
  1116. const { theme } = res.data;
  1117. this.station.theme = theme;
  1118. document.getElementsByTagName(
  1119. "html"
  1120. )[0].style.cssText = `--primary-color: var(--${theme})`;
  1121. });
  1122. this.socket.on("event:station.name.updated", async res => {
  1123. this.station.name = res.data.name;
  1124. await this.$router.push(
  1125. `${res.data.name}?${Object.keys(this.$route.query)
  1126. .map(
  1127. key =>
  1128. `${encodeURIComponent(key)}=${encodeURIComponent(
  1129. this.$route.query[key]
  1130. )}`
  1131. )
  1132. .join("&")}`
  1133. );
  1134. // eslint-disable-next-line no-restricted-globals
  1135. history.replaceState({ ...history.state, ...{} }, null);
  1136. });
  1137. this.socket.on("event:station.displayName.updated", res => {
  1138. this.station.displayName = res.data.displayName;
  1139. });
  1140. this.socket.on("event:station.description.updated", res => {
  1141. this.station.description = res.data.description;
  1142. });
  1143. this.socket.on("event:station.users.updated", res =>
  1144. this.updateUsers(res.data.users)
  1145. );
  1146. this.socket.on("event:station.userCount.updated", res =>
  1147. this.updateUserCount(res.data.userCount)
  1148. );
  1149. this.socket.on("event:station.queue.lock.toggled", res => {
  1150. this.station.locked = res.data.locked;
  1151. });
  1152. this.socket.on("event:user.station.favorited", res => {
  1153. if (res.data.stationId === this.station._id)
  1154. this.updateIfStationIsFavorited({ isFavorited: true });
  1155. });
  1156. this.socket.on("event:user.station.unfavorited", res => {
  1157. if (res.data.stationId === this.station._id)
  1158. this.updateIfStationIsFavorited({ isFavorited: false });
  1159. });
  1160. if (JSON.parse(localStorage.getItem("muted"))) {
  1161. this.muted = true;
  1162. this.player.setVolume(0);
  1163. this.volumeSliderValue = 0 * 100;
  1164. } else {
  1165. let volume = parseFloat(localStorage.getItem("volume"));
  1166. volume =
  1167. typeof volume === "number" && !Number.isNaN(volume)
  1168. ? volume
  1169. : 20;
  1170. localStorage.setItem("volume", volume);
  1171. this.volumeSliderValue = volume * 100;
  1172. }
  1173. },
  1174. beforeUnmount() {
  1175. document.getElementsByTagName("html")[0].style.cssText = "";
  1176. if (this.mediasession) {
  1177. ms.removeListeners(0);
  1178. ms.removeMediaSessionData(0);
  1179. }
  1180. /** Reset Songslist */
  1181. this.updateSongsList([]);
  1182. const shortcutNames = [
  1183. "station.pauseResume",
  1184. "station.skipStation",
  1185. "station.lowerVolumeLarge",
  1186. "station.lowerVolumeSmall",
  1187. "station.increaseVolumeLarge",
  1188. "station.increaseVolumeSmall",
  1189. "station.toggleDebug"
  1190. ];
  1191. shortcutNames.forEach(shortcutName => {
  1192. keyboardShortcuts.unregisterShortcut(shortcutName);
  1193. });
  1194. this.editSongModalWatcher(); // removes the watcher
  1195. clearInterval(this.activityWatchVideoDataInterval);
  1196. clearTimeout(window.stationNextSongTimeout);
  1197. clearTimeout(this.persistentToastCheckerInterval);
  1198. this.persistentToasts.forEach(persistentToast => {
  1199. persistentToast.toast.destroy();
  1200. });
  1201. this.socket.dispatch("stations.leave", this.station._id, () => {});
  1202. this.leaveStation();
  1203. },
  1204. methods: {
  1205. isOwnerOnly() {
  1206. return this.loggedIn && this.userId === this.station.owner;
  1207. },
  1208. isAdminOnly() {
  1209. return this.loggedIn && this.role === "admin";
  1210. },
  1211. isOwnerOrAdmin() {
  1212. return this.isOwnerOnly() || this.isAdminOnly();
  1213. },
  1214. updateMediaSessionData(currentSong) {
  1215. if (currentSong) {
  1216. ms.setMediaSessionData(
  1217. 0,
  1218. !this.localPaused && !this.stationPaused, // This should be improved later
  1219. this.currentSong.title,
  1220. this.currentSong.artists.join(", "),
  1221. null,
  1222. this.currentSong.thumbnail
  1223. );
  1224. } else ms.removeMediaSessionData(0);
  1225. },
  1226. removeFromQueue(youtubeId) {
  1227. window.socket.dispatch(
  1228. "stations.removeFromQueue",
  1229. this.station._id,
  1230. youtubeId,
  1231. res => {
  1232. if (res.status === "success") {
  1233. new Toast("Successfully removed song from the queue.");
  1234. } else new Toast(res.message);
  1235. }
  1236. );
  1237. },
  1238. setNextCurrentSong(nextCurrentSong, skipSkipCheck = false) {
  1239. this.nextCurrentSong = nextCurrentSong;
  1240. // If skipSkipCheck is true, it won't try to skip the song
  1241. if (this.getTimeRemaining() <= 0 && !skipSkipCheck) {
  1242. this.skipSong();
  1243. }
  1244. },
  1245. skipSong() {
  1246. if (this.nextCurrentSong && this.nextCurrentSong.currentSong) {
  1247. const songsList = this.songsList.concat([]);
  1248. if (
  1249. songsList.length > 0 &&
  1250. songsList[0].youtubeId ===
  1251. this.nextCurrentSong.currentSong.youtubeId
  1252. ) {
  1253. songsList.splice(0, 1);
  1254. this.updateSongsList(songsList);
  1255. }
  1256. this.setCurrentSong(this.nextCurrentSong);
  1257. } else {
  1258. this.setCurrentSong({
  1259. currentSong: null,
  1260. startedAt: 0,
  1261. paused: this.stationPaused,
  1262. timePaused: 0,
  1263. pausedAt: 0
  1264. });
  1265. }
  1266. },
  1267. setCurrentSong(data) {
  1268. const { currentSong, startedAt, paused, timePaused, pausedAt } =
  1269. data;
  1270. if (currentSong) {
  1271. if (!currentSong.skipDuration || currentSong.skipDuration < 0)
  1272. currentSong.skipDuration = 0;
  1273. if (!currentSong.duration || currentSong.duration < 0)
  1274. currentSong.duration = 0;
  1275. }
  1276. this.updateCurrentSong(currentSong || {});
  1277. let nextSong = null;
  1278. if (this.songsList[0])
  1279. nextSong = this.songsList[0].youtubeId
  1280. ? this.songsList[0]
  1281. : null;
  1282. this.updateNextSong(nextSong);
  1283. this.setNextCurrentSong(
  1284. {
  1285. currentSong: null,
  1286. startedAt: 0,
  1287. paused,
  1288. timePaused: 0,
  1289. pausedAt: 0
  1290. },
  1291. true
  1292. );
  1293. clearTimeout(window.stationNextSongTimeout);
  1294. if (this.mediasession) this.updateMediaSessionData(currentSong);
  1295. this.startedAt = startedAt;
  1296. this.updateStationPaused(paused);
  1297. this.timePaused = timePaused;
  1298. this.pausedAt = pausedAt;
  1299. if (currentSong) {
  1300. this.updateNoSong(false);
  1301. if (!this.playerReady) this.youtubeReady();
  1302. else this.playVideo();
  1303. // If the station is playing and the backend is not connected, set the next song to skip to after this song and set a timer to skip
  1304. if (!this.stationPaused && !this.socketConnected) {
  1305. if (this.nextSong)
  1306. this.setNextCurrentSong(
  1307. {
  1308. currentSong: this.nextSong,
  1309. startedAt: Date.now() + this.getTimeRemaining(),
  1310. paused: false,
  1311. timePaused: 0
  1312. },
  1313. true
  1314. );
  1315. else
  1316. this.setNextCurrentSong(
  1317. {
  1318. currentSong: null,
  1319. startedAt: 0,
  1320. paused: false,
  1321. timePaused: 0,
  1322. pausedAt: 0
  1323. },
  1324. true
  1325. );
  1326. window.stationNextSongTimeout = setTimeout(() => {
  1327. if (
  1328. !this.noSong &&
  1329. this.currentSong._id === currentSong._id
  1330. )
  1331. this.skipSong("window.stationNextSongTimeout 1");
  1332. }, this.getTimeRemaining());
  1333. }
  1334. const currentSongId = this.currentSong._id;
  1335. this.socket.dispatch(
  1336. "stations.getSkipVotes",
  1337. this.station._id,
  1338. currentSongId,
  1339. res => {
  1340. if (res.status === "success") {
  1341. const { skipVotes, skipVotesCurrent } = res.data;
  1342. if (
  1343. !this.noSong &&
  1344. this.currentSong._id === currentSongId
  1345. ) {
  1346. this.updateCurrentSongSkipVotes({
  1347. skipVotes,
  1348. skipVotesCurrent
  1349. });
  1350. }
  1351. }
  1352. }
  1353. );
  1354. this.socket.dispatch(
  1355. "songs.getSongRatings",
  1356. currentSong._id,
  1357. res => {
  1358. if (currentSong._id === this.currentSong._id) {
  1359. const { likes, dislikes } = res.data;
  1360. this.updateCurrentSongRatings({ likes, dislikes });
  1361. }
  1362. }
  1363. );
  1364. if (this.loggedIn) {
  1365. this.socket.dispatch(
  1366. "songs.getOwnSongRatings",
  1367. currentSong.youtubeId,
  1368. res => {
  1369. console.log("getOwnSongRatings", res);
  1370. if (
  1371. res.status === "success" &&
  1372. this.currentSong.youtubeId ===
  1373. res.data.youtubeId
  1374. ) {
  1375. this.updateOwnCurrentSongRatings(res.data);
  1376. if (
  1377. this.autoSkipDisliked &&
  1378. res.data.disliked === true
  1379. ) {
  1380. this.voteSkipStation();
  1381. new Toast(
  1382. "Automatically voted to skip disliked song."
  1383. );
  1384. }
  1385. }
  1386. }
  1387. );
  1388. }
  1389. } else {
  1390. if (this.playerReady) this.player.pauseVideo();
  1391. this.updateNoSong(true);
  1392. }
  1393. this.calculateTimeElapsed();
  1394. this.resizeSeekerbar();
  1395. },
  1396. youtubeReady() {
  1397. if (!this.player) {
  1398. ms.setYTReady(false);
  1399. this.player = new window.YT.Player("stationPlayer", {
  1400. height: 270,
  1401. width: 480,
  1402. videoId: this.currentSong.youtubeId,
  1403. host: "https://www.youtube-nocookie.com",
  1404. startSeconds:
  1405. this.getTimeElapsed() / 1000 +
  1406. this.currentSong.skipDuration,
  1407. playerVars: {
  1408. controls: 0,
  1409. iv_load_policy: 3,
  1410. rel: 0,
  1411. showinfo: 0,
  1412. disablekb: 1,
  1413. playsinline: 1
  1414. },
  1415. events: {
  1416. onReady: () => {
  1417. this.playerReady = true;
  1418. ms.setYTReady(true);
  1419. let volume = parseInt(
  1420. localStorage.getItem("volume")
  1421. );
  1422. volume = typeof volume === "number" ? volume : 20;
  1423. this.player.setVolume(volume);
  1424. if (volume > 0) this.player.unMute();
  1425. if (this.muted) this.player.mute();
  1426. this.playVideo();
  1427. // on ios, playback will be forcibly paused locally
  1428. if (this.isApple) {
  1429. this.updateLocalPaused(true);
  1430. new Toast(
  1431. "Please click play manually to use Musare on iOS."
  1432. );
  1433. }
  1434. },
  1435. onError: err => {
  1436. console.log("error with youtube video", err);
  1437. if (err.data === 150 && this.loggedIn) {
  1438. new Toast(
  1439. "Automatically voted to skip as this song isn't available for you."
  1440. );
  1441. // automatically vote to skip
  1442. this.voteSkipStation();
  1443. // persistent message while song is playing
  1444. const persistentToast = new Toast({
  1445. content:
  1446. "This song is unavailable for you, but is playing for everyone else.",
  1447. persistent: true
  1448. });
  1449. // save current song id
  1450. const erroredYoutubeId =
  1451. this.currentSong.youtubeId;
  1452. this.persistentToasts.push({
  1453. toast: persistentToast,
  1454. checkIfCanRemove: () => {
  1455. if (
  1456. this.currentSong.youtubeId !==
  1457. erroredYoutubeId
  1458. ) {
  1459. persistentToast.destroy();
  1460. return true;
  1461. }
  1462. return false;
  1463. }
  1464. });
  1465. } else {
  1466. new Toast(
  1467. "There has been an error with the YouTube Embed"
  1468. );
  1469. }
  1470. },
  1471. onStateChange: event => {
  1472. if (
  1473. event.data === window.YT.PlayerState.PLAYING &&
  1474. this.videoLoading === true
  1475. ) {
  1476. this.videoLoading = false;
  1477. this.player.seekTo(
  1478. this.getTimeElapsed() / 1000 +
  1479. this.currentSong.skipDuration,
  1480. true
  1481. );
  1482. this.canAutoplay = true;
  1483. if (this.localPaused || this.stationPaused)
  1484. this.player.pauseVideo();
  1485. } else if (
  1486. event.data === window.YT.PlayerState.PLAYING &&
  1487. (this.localPaused || this.stationPaused)
  1488. ) {
  1489. this.player.seekTo(
  1490. this.timeBeforePause / 1000,
  1491. true
  1492. );
  1493. this.player.pauseVideo();
  1494. } else if (
  1495. event.data === window.YT.PlayerState.PLAYING &&
  1496. this.seeking === true
  1497. )
  1498. this.seeking = false;
  1499. if (
  1500. event.data === window.YT.PlayerState.PAUSED &&
  1501. !this.localPaused &&
  1502. !this.stationPaused &&
  1503. !this.noSong &&
  1504. this.player.getDuration() / 1000 <
  1505. this.currentSong.duration
  1506. ) {
  1507. this.player.seekTo(
  1508. this.getTimeElapsed() / 1000 +
  1509. this.currentSong.skipDuration,
  1510. true
  1511. );
  1512. this.player.playVideo();
  1513. }
  1514. }
  1515. }
  1516. });
  1517. }
  1518. },
  1519. getTimeElapsed() {
  1520. if (this.currentSong) {
  1521. let { timePaused } = this;
  1522. if (this.stationPaused)
  1523. timePaused += Date.currently() - this.pausedAt;
  1524. return Date.currently() - this.startedAt - timePaused;
  1525. }
  1526. return 0;
  1527. },
  1528. getTimeRemaining() {
  1529. if (this.currentSong) {
  1530. return this.currentSong.duration * 1000 - this.getTimeElapsed();
  1531. }
  1532. return 0;
  1533. },
  1534. playVideo() {
  1535. if (this.playerReady) {
  1536. this.videoLoading = true;
  1537. this.player.loadVideoById(
  1538. this.currentSong.youtubeId,
  1539. this.getTimeElapsed() / 1000 + this.currentSong.skipDuration
  1540. );
  1541. if (window.stationInterval !== 0)
  1542. clearInterval(window.stationInterval);
  1543. window.stationInterval = setInterval(() => {
  1544. if (!this.stationPaused) {
  1545. this.resizeSeekerbar();
  1546. this.calculateTimeElapsed();
  1547. }
  1548. }, 150);
  1549. }
  1550. },
  1551. resizeSeekerbar() {
  1552. this.seekerbarPercentage = parseFloat(
  1553. (this.getTimeElapsed() / 1000 / this.currentSong.duration) * 100
  1554. );
  1555. },
  1556. calculateTimeElapsed() {
  1557. if (
  1558. this.playerReady &&
  1559. !this.noSong &&
  1560. this.currentSong &&
  1561. this.player.getPlayerState() === -1
  1562. ) {
  1563. if (!this.canAutoplay) {
  1564. if (
  1565. Date.now() - this.lastTimeRequestedIfCanAutoplay >
  1566. 2000
  1567. ) {
  1568. this.lastTimeRequestedIfCanAutoplay = Date.now();
  1569. canAutoPlay.video().then(({ result }) => {
  1570. if (result) {
  1571. this.attemptsToPlayVideo = 0;
  1572. this.canAutoplay = true;
  1573. } else {
  1574. this.canAutoplay = false;
  1575. }
  1576. });
  1577. }
  1578. } else {
  1579. this.player.playVideo();
  1580. this.attemptsToPlayVideo += 1;
  1581. }
  1582. }
  1583. if (
  1584. !this.stationPaused &&
  1585. !this.localPaused &&
  1586. this.playerReady &&
  1587. !this.isApple
  1588. ) {
  1589. const timeElapsed = this.getTimeElapsed();
  1590. const currentPlayerTime =
  1591. Math.max(
  1592. this.player.getCurrentTime() -
  1593. this.currentSong.skipDuration,
  1594. 0
  1595. ) * 1000;
  1596. const difference = timeElapsed - currentPlayerTime;
  1597. let playbackRate = 1;
  1598. if (difference < -2000) {
  1599. if (!this.seeking) {
  1600. this.seeking = true;
  1601. this.player.seekTo(
  1602. this.getTimeElapsed() / 1000 +
  1603. this.currentSong.skipDuration
  1604. );
  1605. }
  1606. } else if (difference < -200) {
  1607. playbackRate = 0.8;
  1608. } else if (difference < -50) {
  1609. playbackRate = 0.9;
  1610. } else if (difference < -25) {
  1611. playbackRate = 0.95;
  1612. } else if (difference > 2000) {
  1613. if (!this.seeking) {
  1614. this.seeking = true;
  1615. this.player.seekTo(
  1616. this.getTimeElapsed() / 1000 +
  1617. this.currentSong.skipDuration
  1618. );
  1619. }
  1620. } else if (difference > 200) {
  1621. playbackRate = 1.2;
  1622. } else if (difference > 50) {
  1623. playbackRate = 1.1;
  1624. } else if (difference > 25) {
  1625. playbackRate = 1.05;
  1626. } else if (this.player.getPlaybackRate !== 1.0) {
  1627. this.player.setPlaybackRate(1.0);
  1628. }
  1629. if (this.playbackRate !== playbackRate) {
  1630. this.player.setPlaybackRate(playbackRate);
  1631. this.playbackRate = playbackRate;
  1632. }
  1633. }
  1634. let { timePaused } = this;
  1635. if (this.stationPaused)
  1636. timePaused += Date.currently() - this.pausedAt;
  1637. const duration =
  1638. (Date.currently() - this.startedAt - timePaused) / 1000;
  1639. const songDuration = this.currentSong.duration;
  1640. if (songDuration <= duration) this.player.pauseVideo();
  1641. if (duration <= songDuration)
  1642. this.timeElapsed = utils.formatTime(duration);
  1643. },
  1644. toggleLock() {
  1645. window.socket.dispatch(
  1646. "stations.toggleLock",
  1647. this.station._id,
  1648. res => {
  1649. if (res.status === "success") {
  1650. new Toast("Successfully toggled the queue lock.");
  1651. } else new Toast(res.message);
  1652. }
  1653. );
  1654. },
  1655. changeVolume() {
  1656. const volume = this.volumeSliderValue;
  1657. localStorage.setItem("volume", volume / 100);
  1658. if (this.playerReady) {
  1659. this.player.setVolume(volume / 100);
  1660. if (volume > 0) {
  1661. this.player.unMute();
  1662. localStorage.setItem("muted", false);
  1663. this.muted = false;
  1664. }
  1665. }
  1666. },
  1667. resumeLocalStation() {
  1668. this.updateLocalPaused(false);
  1669. if (!this.stationPaused) this.resumeLocalPlayer();
  1670. },
  1671. pauseLocalStation() {
  1672. this.updateLocalPaused(true);
  1673. this.pauseLocalPlayer();
  1674. },
  1675. resumeLocalPlayer() {
  1676. if (this.mediasession)
  1677. this.updateMediaSessionData(this.currentSong);
  1678. if (!this.noSong) {
  1679. if (this.playerReady) {
  1680. this.player.seekTo(
  1681. this.getTimeElapsed() / 1000 +
  1682. this.currentSong.skipDuration
  1683. );
  1684. this.player.playVideo();
  1685. }
  1686. }
  1687. },
  1688. pauseLocalPlayer() {
  1689. if (this.mediasession)
  1690. this.updateMediaSessionData(this.currentSong);
  1691. if (!this.noSong) {
  1692. this.timeBeforePause = this.getTimeElapsed();
  1693. if (this.playerReady) this.player.pauseVideo();
  1694. }
  1695. },
  1696. skipStation() {
  1697. this.socket.dispatch(
  1698. "stations.forceSkip",
  1699. this.station._id,
  1700. data => {
  1701. if (data.status !== "success")
  1702. new Toast(`Error: ${data.message}`);
  1703. else
  1704. new Toast(
  1705. "Successfully skipped the station's current song."
  1706. );
  1707. }
  1708. );
  1709. },
  1710. voteSkipStation() {
  1711. this.socket.dispatch(
  1712. "stations.voteSkip",
  1713. this.station._id,
  1714. data => {
  1715. if (data.status !== "success")
  1716. new Toast(`Error: ${data.message}`);
  1717. else
  1718. new Toast(
  1719. "Successfully voted to skip the current song."
  1720. );
  1721. }
  1722. );
  1723. },
  1724. resumeStation() {
  1725. this.socket.dispatch("stations.resume", this.station._id, data => {
  1726. if (data.status !== "success")
  1727. new Toast(`Error: ${data.message}`);
  1728. else new Toast("Successfully resumed the station.");
  1729. });
  1730. },
  1731. pauseStation() {
  1732. this.socket.dispatch("stations.pause", this.station._id, data => {
  1733. if (data.status !== "success")
  1734. new Toast(`Error: ${data.message}`);
  1735. else new Toast("Successfully paused the station.");
  1736. });
  1737. },
  1738. toggleMute() {
  1739. if (this.playerReady) {
  1740. const previousVolume = parseFloat(
  1741. localStorage.getItem("volume")
  1742. );
  1743. const volume =
  1744. this.player.getVolume() * 100 <= 0 ? previousVolume : 0;
  1745. this.muted = !this.muted;
  1746. localStorage.setItem("muted", this.muted);
  1747. this.volumeSliderValue = volume * 100;
  1748. this.player.setVolume(volume);
  1749. if (!this.muted) localStorage.setItem("volume", volume);
  1750. }
  1751. },
  1752. increaseVolume() {
  1753. if (this.playerReady) {
  1754. const previousVolume = parseInt(localStorage.getItem("volume"));
  1755. let volume = previousVolume + 5;
  1756. if (previousVolume === 0) {
  1757. this.muted = false;
  1758. localStorage.setItem("muted", false);
  1759. }
  1760. if (volume > 100) volume = 100;
  1761. this.volumeSliderValue = volume * 100;
  1762. this.player.setVolume(volume);
  1763. localStorage.setItem("volume", volume);
  1764. }
  1765. },
  1766. toggleLike() {
  1767. if (this.currentSong.liked)
  1768. this.socket.dispatch(
  1769. "songs.unlike",
  1770. this.currentSong.youtubeId,
  1771. res => {
  1772. if (res.status !== "success")
  1773. new Toast(`Error: ${res.message}`);
  1774. }
  1775. );
  1776. else
  1777. this.socket.dispatch(
  1778. "songs.like",
  1779. this.currentSong.youtubeId,
  1780. res => {
  1781. if (res.status !== "success")
  1782. new Toast(`Error: ${res.message}`);
  1783. }
  1784. );
  1785. },
  1786. toggleDislike() {
  1787. if (this.currentSong.disliked)
  1788. return this.socket.dispatch(
  1789. "songs.undislike",
  1790. this.currentSong.youtubeId,
  1791. res => {
  1792. if (res.status !== "success")
  1793. new Toast(`Error: ${res.message}`);
  1794. }
  1795. );
  1796. return this.socket.dispatch(
  1797. "songs.dislike",
  1798. this.currentSong.youtubeId,
  1799. res => {
  1800. if (res.status !== "success")
  1801. new Toast(`Error: ${res.message}`);
  1802. }
  1803. );
  1804. },
  1805. addPartyPlaylistSongToQueue() {
  1806. if (
  1807. !this.partyPlaylistLock &&
  1808. this.station.type === "community" &&
  1809. this.station.partyMode === true &&
  1810. this.songsList.length < 50 &&
  1811. this.currentUserQueueSongs < 3 &&
  1812. this.partyPlaylists.length > 0
  1813. ) {
  1814. const selectedPlaylist =
  1815. this.partyPlaylists[
  1816. Math.floor(Math.random() * this.partyPlaylists.length)
  1817. ];
  1818. if (selectedPlaylist._id && selectedPlaylist.songs.length > 0) {
  1819. const selectedSong =
  1820. selectedPlaylist.songs[
  1821. Math.floor(
  1822. Math.random() * selectedPlaylist.songs.length
  1823. )
  1824. ];
  1825. if (selectedSong.youtubeId) {
  1826. this.partyPlaylistLock = true;
  1827. this.socket.dispatch(
  1828. "stations.addToQueue",
  1829. this.station._id,
  1830. selectedSong.youtubeId,
  1831. data => {
  1832. this.partyPlaylistLock = false;
  1833. if (data.status !== "success")
  1834. this.addPartyPlaylistSongToQueue();
  1835. }
  1836. );
  1837. }
  1838. }
  1839. }
  1840. },
  1841. togglePlayerDebugBox() {
  1842. this.$refs.playerDebugBox.toggleBox();
  1843. },
  1844. resetPlayerDebugBox() {
  1845. this.$refs.playerDebugBox.resetBox();
  1846. },
  1847. toggleKeyboardShortcutsHelper() {
  1848. this.$refs.keyboardShortcutsHelper.toggleBox();
  1849. },
  1850. resetKeyboardShortcutsHelper() {
  1851. this.$refs.keyboardShortcutsHelper.resetBox();
  1852. },
  1853. join() {
  1854. this.socket.dispatch(
  1855. "stations.join",
  1856. this.stationIdentifier,
  1857. res => {
  1858. if (res.status === "success") {
  1859. setTimeout(() => {
  1860. this.loading = false;
  1861. }, 1000); // prevents popping in of youtube embed etc.
  1862. const {
  1863. _id,
  1864. displayName,
  1865. name,
  1866. description,
  1867. privacy,
  1868. locked,
  1869. partyMode,
  1870. owner,
  1871. privatePlaylist,
  1872. includedPlaylists,
  1873. excludedPlaylists,
  1874. type,
  1875. genres,
  1876. blacklistedGenres,
  1877. isFavorited,
  1878. theme
  1879. } = res.data;
  1880. // change url to use station name instead of station id
  1881. if (name !== this.stationIdentifier) {
  1882. // eslint-disable-next-line no-restricted-globals
  1883. this.$router.replace(name);
  1884. }
  1885. this.joinStation({
  1886. _id,
  1887. name,
  1888. displayName,
  1889. description,
  1890. privacy,
  1891. locked,
  1892. partyMode,
  1893. owner,
  1894. privatePlaylist,
  1895. includedPlaylists,
  1896. excludedPlaylists,
  1897. type,
  1898. genres,
  1899. blacklistedGenres,
  1900. isFavorited,
  1901. theme
  1902. });
  1903. document.getElementsByTagName(
  1904. "html"
  1905. )[0].style.cssText = `--primary-color: var(--${res.data.theme})`;
  1906. this.setCurrentSong({
  1907. currentSong: res.data.currentSong,
  1908. startedAt: res.data.startedAt,
  1909. paused: res.data.paused,
  1910. timePaused: res.data.timePaused,
  1911. pausedAt: res.data.pausedAt
  1912. });
  1913. this.updateUserCount(res.data.userCount);
  1914. this.updateUsers(res.data.users);
  1915. this.socket.dispatch(
  1916. "stations.getStationIncludedPlaylistsById",
  1917. this.station._id,
  1918. res => {
  1919. if (res.status === "success") {
  1920. this.setIncludedPlaylists(
  1921. res.data.playlists
  1922. );
  1923. }
  1924. }
  1925. );
  1926. this.socket.dispatch(
  1927. "stations.getStationExcludedPlaylistsById",
  1928. this.station._id,
  1929. res => {
  1930. if (res.status === "success") {
  1931. this.setExcludedPlaylists(
  1932. res.data.playlists
  1933. );
  1934. }
  1935. }
  1936. );
  1937. this.socket.dispatch("stations.getQueue", _id, res => {
  1938. if (res.status === "success") {
  1939. const { queue } = res.data;
  1940. this.updateSongsList(queue);
  1941. const [nextSong] = queue;
  1942. this.updateNextSong(nextSong);
  1943. }
  1944. });
  1945. if (this.isOwnerOrAdmin()) {
  1946. keyboardShortcuts.registerShortcut(
  1947. "station.pauseResume",
  1948. {
  1949. keyCode: 32, // Spacebar
  1950. shift: false,
  1951. ctrl: true,
  1952. preventDefault: true,
  1953. handler: () => {
  1954. if (this.aModalIsOpen) return;
  1955. if (this.stationPaused)
  1956. this.resumeStation();
  1957. else this.pauseStation();
  1958. }
  1959. }
  1960. );
  1961. keyboardShortcuts.registerShortcut(
  1962. "station.skipStation",
  1963. {
  1964. keyCode: 39, // Right arrow key
  1965. shift: false,
  1966. ctrl: true,
  1967. preventDefault: true,
  1968. handler: () => {
  1969. if (this.aModalIsOpen) return;
  1970. this.skipStation();
  1971. }
  1972. }
  1973. );
  1974. }
  1975. keyboardShortcuts.registerShortcut(
  1976. "station.lowerVolumeLarge",
  1977. {
  1978. keyCode: 40, // Down arrow key
  1979. shift: false,
  1980. ctrl: true,
  1981. preventDefault: true,
  1982. handler: () => {
  1983. if (this.aModalIsOpen) return;
  1984. this.volumeSliderValue -= 1000;
  1985. this.changeVolume();
  1986. }
  1987. }
  1988. );
  1989. keyboardShortcuts.registerShortcut(
  1990. "station.lowerVolumeSmall",
  1991. {
  1992. keyCode: 40, // Down arrow key
  1993. shift: true,
  1994. ctrl: true,
  1995. preventDefault: true,
  1996. handler: () => {
  1997. if (this.aModalIsOpen) return;
  1998. this.volumeSliderValue -= 100;
  1999. this.changeVolume();
  2000. }
  2001. }
  2002. );
  2003. keyboardShortcuts.registerShortcut(
  2004. "station.increaseVolumeLarge",
  2005. {
  2006. keyCode: 38, // Up arrow key
  2007. shift: false,
  2008. ctrl: true,
  2009. preventDefault: true,
  2010. handler: () => {
  2011. if (this.aModalIsOpen) return;
  2012. this.volumeSliderValue += 1000;
  2013. this.changeVolume();
  2014. }
  2015. }
  2016. );
  2017. keyboardShortcuts.registerShortcut(
  2018. "station.increaseVolumeSmall",
  2019. {
  2020. keyCode: 38, // Up arrow key
  2021. shift: true,
  2022. ctrl: true,
  2023. preventDefault: true,
  2024. handler: () => {
  2025. if (this.aModalIsOpen) return;
  2026. this.volumeSliderValue += 100;
  2027. this.changeVolume();
  2028. }
  2029. }
  2030. );
  2031. keyboardShortcuts.registerShortcut(
  2032. "station.toggleDebug",
  2033. {
  2034. keyCode: 68, // D key
  2035. shift: false,
  2036. ctrl: true,
  2037. preventDefault: true,
  2038. handler: () => {
  2039. if (this.aModalIsOpen) return;
  2040. this.togglePlayerDebugBox();
  2041. }
  2042. }
  2043. );
  2044. keyboardShortcuts.registerShortcut(
  2045. "station.toggleKeyboardShortcutsHelper",
  2046. {
  2047. keyCode: 191, // '/' key
  2048. ctrl: true,
  2049. preventDefault: true,
  2050. handler: () => {
  2051. if (this.aModalIsOpen) return;
  2052. this.toggleKeyboardShortcutsHelper();
  2053. }
  2054. }
  2055. );
  2056. keyboardShortcuts.registerShortcut(
  2057. "station.resetKeyboardShortcutsHelper",
  2058. {
  2059. keyCode: 191, // '/' key
  2060. ctrl: true,
  2061. shift: true,
  2062. preventDefault: true,
  2063. handler: () => {
  2064. if (this.aModalIsOpen) return;
  2065. this.resetKeyboardShortcutsHelper();
  2066. }
  2067. }
  2068. );
  2069. // UNIX client time before ping
  2070. const beforePing = Date.now();
  2071. this.socket.dispatch("apis.ping", res => {
  2072. if (res.status === "success") {
  2073. // UNIX client time after ping
  2074. const afterPing = Date.now();
  2075. // Average time in MS it took between the server responding and the client receiving
  2076. const connectionLatency =
  2077. (afterPing - beforePing) / 2;
  2078. console.log(
  2079. connectionLatency,
  2080. beforePing - afterPing
  2081. );
  2082. // UNIX server time
  2083. const serverDate = res.data.date;
  2084. // Difference between the server UNIX time and the client UNIX time after ping, with the connectionLatency added to the server UNIX time
  2085. const difference =
  2086. serverDate + connectionLatency - afterPing;
  2087. console.log("Difference: ", difference);
  2088. if (difference > 3000 || difference < -3000) {
  2089. console.log(
  2090. "System time difference is bigger than 3 seconds."
  2091. );
  2092. }
  2093. this.systemDifference = difference;
  2094. }
  2095. });
  2096. } else {
  2097. this.loading = false;
  2098. this.exists = false;
  2099. }
  2100. }
  2101. );
  2102. },
  2103. favoriteStation() {
  2104. this.socket.dispatch(
  2105. "stations.favoriteStation",
  2106. this.station._id,
  2107. res => {
  2108. if (res.status === "success") {
  2109. new Toast("Successfully favorited station.");
  2110. } else new Toast(res.message);
  2111. }
  2112. );
  2113. },
  2114. unfavoriteStation() {
  2115. this.socket.dispatch(
  2116. "stations.unfavoriteStation",
  2117. this.station._id,
  2118. res => {
  2119. if (res.status === "success") {
  2120. new Toast("Successfully unfavorited station.");
  2121. } else new Toast(res.message);
  2122. }
  2123. );
  2124. },
  2125. sendActivityWatchVideoData() {
  2126. if (!this.stationPaused && !this.localPaused && !this.noSong) {
  2127. if (this.activityWatchVideoLastStatus !== "playing") {
  2128. this.activityWatchVideoLastStatus = "playing";
  2129. this.activityWatchVideoLastStartDuration =
  2130. this.currentSong.skipDuration + this.getTimeElapsed();
  2131. }
  2132. if (
  2133. this.activityWatchVideoLastYouTubeId !==
  2134. this.currentSong.youtubeId
  2135. ) {
  2136. this.activityWatchVideoLastYouTubeId =
  2137. this.currentSong.youtubeId;
  2138. this.activityWatchVideoLastStartDuration =
  2139. this.currentSong.skipDuration + this.getTimeElapsed();
  2140. }
  2141. const videoData = {
  2142. title: this.currentSong ? this.currentSong.title : null,
  2143. artists:
  2144. this.currentSong && this.currentSong.artists
  2145. ? this.currentSong.artists.join(", ")
  2146. : null,
  2147. youtubeId: this.currentSong.youtubeId,
  2148. muted: this.muted,
  2149. volume: this.volumeSliderValue / 100,
  2150. startedDuration:
  2151. this.activityWatchVideoLastStartDuration <= 0
  2152. ? 0
  2153. : Math.floor(
  2154. this.activityWatchVideoLastStartDuration /
  2155. 1000
  2156. ),
  2157. source: `station#${this.station.name}`,
  2158. hostname: window.location.hostname
  2159. };
  2160. aw.sendVideoData(videoData);
  2161. } else {
  2162. this.activityWatchVideoLastStatus = "not_playing";
  2163. }
  2164. },
  2165. ...mapActions("modalVisibility", ["openModal"]),
  2166. ...mapActions("station", [
  2167. "joinStation",
  2168. "leaveStation",
  2169. "updateUserCount",
  2170. "updateUsers",
  2171. "updateCurrentSong",
  2172. "updateNextSong",
  2173. "updateSongsList",
  2174. "repositionSongInList",
  2175. "updateStationPaused",
  2176. "updateLocalPaused",
  2177. "updateNoSong",
  2178. "updateIfStationIsFavorited",
  2179. "setIncludedPlaylists",
  2180. "setExcludedPlaylists",
  2181. "updateCurrentSongRatings",
  2182. "updateOwnCurrentSongRatings",
  2183. "updateCurrentSongSkipVotes"
  2184. ]),
  2185. ...mapActions("modals/editSong", ["stopVideo"])
  2186. }
  2187. };
  2188. </script>
  2189. <style lang="less">
  2190. #stationPlayer {
  2191. position: absolute;
  2192. top: 0;
  2193. left: 0;
  2194. width: 100%;
  2195. height: 100%;
  2196. }
  2197. #currently-playing-container,
  2198. #next-up-container {
  2199. .song-item {
  2200. .thumbnail {
  2201. min-width: 130px;
  2202. width: 130px;
  2203. height: 130px;
  2204. }
  2205. }
  2206. }
  2207. #control-bar-container
  2208. #right-buttons
  2209. .tippy-box[data-theme~="dropdown"]
  2210. .nav-dropdown-items {
  2211. padding-bottom: 0 !important;
  2212. }
  2213. </style>
  2214. <style lang="less" scoped>
  2215. #page-loader-container {
  2216. height: inherit;
  2217. #page-loader-content {
  2218. height: inherit;
  2219. position: absolute;
  2220. max-width: 100%;
  2221. width: 1800px;
  2222. transform: translateX(-50%);
  2223. left: 50%;
  2224. }
  2225. #page-loader-layout {
  2226. height: inherit;
  2227. width: 100%;
  2228. }
  2229. }
  2230. #mobile-progress-animation {
  2231. width: 50px;
  2232. animation: rotate 0.8s infinite linear;
  2233. border: 8px solid var(--primary-color);
  2234. border-right-color: transparent;
  2235. border-radius: 50%;
  2236. height: 50px;
  2237. position: absolute;
  2238. top: 50%;
  2239. left: 50%;
  2240. display: none;
  2241. }
  2242. @keyframes rotate {
  2243. 0% {
  2244. transform: rotate(0deg);
  2245. }
  2246. 100% {
  2247. transform: rotate(360deg);
  2248. }
  2249. }
  2250. .nav,
  2251. .button.is-primary {
  2252. background-color: var(--primary-color) !important;
  2253. }
  2254. .button.is-primary:hover,
  2255. .button.is-primary:focus {
  2256. filter: brightness(90%);
  2257. }
  2258. .night-mode {
  2259. #currently-playing-container,
  2260. #next-up-container,
  2261. #about-station-container,
  2262. #control-bar-container,
  2263. .player-container {
  2264. background-color: var(--dark-grey-3) !important;
  2265. }
  2266. #video-container,
  2267. #control-bar-container,
  2268. .quadrant:not(#sidebar-container),
  2269. .player-container {
  2270. border: 0 !important;
  2271. }
  2272. #seeker-bar-container {
  2273. background-color: var(--dark-grey-3) !important;
  2274. }
  2275. #dropdown-toggle {
  2276. background-color: var(--dark-grey-2) !important;
  2277. border: 0;
  2278. i {
  2279. color: var(--white);
  2280. }
  2281. }
  2282. }
  2283. #station-outer-container {
  2284. margin: 0 auto;
  2285. padding: 20px 40px;
  2286. min-height: calc(100vh - 64px);
  2287. width: 100%;
  2288. max-width: 1800px;
  2289. display: flex;
  2290. #station-inner-container {
  2291. width: 100%;
  2292. min-height: calc(100vh - 428px);
  2293. display: flex;
  2294. flex-direction: row;
  2295. flex-wrap: wrap;
  2296. .row {
  2297. display: flex;
  2298. flex-direction: row;
  2299. max-width: 100%;
  2300. }
  2301. .column {
  2302. display: flex;
  2303. flex-direction: column;
  2304. }
  2305. .quadrant {
  2306. border-radius: @border-radius;
  2307. margin: 10px;
  2308. }
  2309. .quadrant:not(#sidebar-container) {
  2310. background-color: var(--white);
  2311. border: 1px solid var(--light-grey-3);
  2312. }
  2313. #station-left-column,
  2314. #station-right-column {
  2315. padding: 0;
  2316. }
  2317. #about-station-container {
  2318. padding: 20px;
  2319. display: flex;
  2320. flex-direction: column;
  2321. flex-grow: unset;
  2322. #station-info {
  2323. #station-name {
  2324. flex-direction: row !important;
  2325. h1 {
  2326. margin: 0;
  2327. font-size: 36px;
  2328. line-height: 0.8;
  2329. text-overflow: ellipsis;
  2330. overflow: hidden;
  2331. }
  2332. i {
  2333. margin-left: 10px;
  2334. font-size: 30px;
  2335. color: var(--yellow);
  2336. &.stationMode {
  2337. padding-left: 10px;
  2338. margin-left: auto;
  2339. color: var(--primary-color);
  2340. }
  2341. }
  2342. .verified-station {
  2343. color: var(--primary-color);
  2344. }
  2345. }
  2346. p {
  2347. display: -webkit-box;
  2348. max-width: 700px;
  2349. margin-bottom: 10px;
  2350. overflow: hidden;
  2351. text-overflow: ellipsis;
  2352. -webkit-box-orient: vertical;
  2353. -webkit-line-clamp: 3;
  2354. }
  2355. }
  2356. #admin-buttons {
  2357. display: flex;
  2358. .button {
  2359. margin: 3px;
  2360. }
  2361. }
  2362. }
  2363. #current-next-row {
  2364. display: flex;
  2365. flex-direction: row;
  2366. #currently-playing-container,
  2367. #next-up-container {
  2368. overflow: hidden;
  2369. flex-basis: 50%;
  2370. .song-item {
  2371. border: unset;
  2372. }
  2373. .nothing-here-text {
  2374. height: 100%;
  2375. }
  2376. }
  2377. > div:only-child {
  2378. flex: 1 !important;
  2379. flex-basis: 100% !important;
  2380. }
  2381. }
  2382. .player-container {
  2383. height: inherit;
  2384. background-color: var(--white);
  2385. display: flex;
  2386. flex-direction: column;
  2387. border: 1px solid var(--light-grey-3);
  2388. border-radius: @border-radius;
  2389. overflow: hidden;
  2390. &.nothing-here-text {
  2391. margin: 10px;
  2392. flex: 1;
  2393. min-height: 487px;
  2394. }
  2395. #video-container {
  2396. position: relative;
  2397. padding-bottom: 56.25%; /* proportion value to aspect ratio 16:9 (9 / 16 = 0.5625 or 56.25%) */
  2398. height: 0;
  2399. overflow: hidden;
  2400. .player-cannot-autoplay {
  2401. position: relative;
  2402. width: 100%;
  2403. height: 100%;
  2404. bottom: calc(100% + 5px);
  2405. background: var(--primary-color);
  2406. display: flex;
  2407. align-items: center;
  2408. justify-content: center;
  2409. p {
  2410. color: var(--white);
  2411. font-size: 26px;
  2412. text-align: center;
  2413. }
  2414. }
  2415. }
  2416. #seeker-bar-container {
  2417. background-color: var(--white);
  2418. position: relative;
  2419. height: 7px;
  2420. display: block;
  2421. width: 100%;
  2422. #seeker-bar {
  2423. background-color: var(--primary-color);
  2424. top: 0;
  2425. left: 0;
  2426. bottom: 0;
  2427. position: absolute;
  2428. width: 100%;
  2429. }
  2430. .seeker-bar-cover {
  2431. position: absolute;
  2432. top: 0;
  2433. right: 0;
  2434. bottom: 0;
  2435. background-color: inherit;
  2436. }
  2437. }
  2438. #control-bar-container {
  2439. display: flex;
  2440. justify-content: space-around;
  2441. padding: 10px 0;
  2442. width: 100%;
  2443. background: var(--white);
  2444. flex-direction: column;
  2445. flex-flow: wrap;
  2446. .button:not(#dropdown-toggle) {
  2447. width: 75px;
  2448. }
  2449. #left-buttons,
  2450. #right-buttons {
  2451. margin: 3px;
  2452. }
  2453. #left-buttons {
  2454. display: flex;
  2455. .button:not(:first-of-type) {
  2456. margin-left: 5px;
  2457. }
  2458. .disabled {
  2459. filter: grayscale(0.4);
  2460. }
  2461. }
  2462. #duration {
  2463. margin: 3px;
  2464. display: flex;
  2465. align-items: center;
  2466. p {
  2467. font-size: 22px;
  2468. /** prevents duration width slightly varying and shifting other controls slightly */
  2469. width: 150px;
  2470. text-align: center;
  2471. }
  2472. }
  2473. #volume-control {
  2474. margin: 3px;
  2475. margin-top: 0;
  2476. display: flex;
  2477. align-items: center;
  2478. cursor: pointer;
  2479. .volume-slider {
  2480. width: 100%;
  2481. padding: 0 15px;
  2482. background: transparent;
  2483. min-width: 100px;
  2484. }
  2485. input[type="range"] {
  2486. -webkit-appearance: none;
  2487. margin: 7.3px 0;
  2488. }
  2489. input[type="range"]:focus {
  2490. outline: none;
  2491. }
  2492. input[type="range"]::-webkit-slider-runnable-track {
  2493. width: 100%;
  2494. height: 5.2px;
  2495. cursor: pointer;
  2496. box-shadow: 0;
  2497. background: var(--light-grey-3);
  2498. border-radius: 0;
  2499. border: 0;
  2500. }
  2501. input[type="range"]::-webkit-slider-thumb {
  2502. box-shadow: 0;
  2503. border: 0;
  2504. height: 19px;
  2505. width: 19px;
  2506. border-radius: 15px;
  2507. background: var(--primary-color);
  2508. cursor: pointer;
  2509. -webkit-appearance: none;
  2510. margin-top: -6.5px;
  2511. }
  2512. input[type="range"]::-moz-range-track {
  2513. width: 100%;
  2514. height: 5.2px;
  2515. cursor: pointer;
  2516. box-shadow: 0;
  2517. background: var(--light-grey-3);
  2518. border-radius: 0;
  2519. border: 0;
  2520. }
  2521. input[type="range"]::-moz-range-thumb {
  2522. box-shadow: 0;
  2523. border: 0;
  2524. height: 19px;
  2525. width: 19px;
  2526. border-radius: 15px;
  2527. background: var(--primary-color);
  2528. cursor: pointer;
  2529. -webkit-appearance: none;
  2530. margin-top: -6.5px;
  2531. }
  2532. input[type="range"]::-ms-track {
  2533. width: 100%;
  2534. height: 5.2px;
  2535. cursor: pointer;
  2536. box-shadow: 0;
  2537. background: var(--light-grey-3);
  2538. border-radius: 1.3px;
  2539. }
  2540. input[type="range"]::-ms-fill-lower {
  2541. background: var(--light-grey-3);
  2542. border: 0;
  2543. border-radius: 0;
  2544. box-shadow: 0;
  2545. }
  2546. input[type="range"]::-ms-fill-upper {
  2547. background: var(--light-grey-3);
  2548. border: 0;
  2549. border-radius: 0;
  2550. box-shadow: 0;
  2551. }
  2552. input[type="range"]::-ms-thumb {
  2553. box-shadow: 0;
  2554. border: 0;
  2555. height: 15px;
  2556. width: 15px;
  2557. border-radius: 15px;
  2558. background: var(--primary-color);
  2559. cursor: pointer;
  2560. -webkit-appearance: none;
  2561. margin-top: 1.5px;
  2562. }
  2563. }
  2564. #right-buttons {
  2565. display: flex;
  2566. #dropdown-toggle {
  2567. width: 35px;
  2568. }
  2569. #dislike-song,
  2570. #add-song-to-playlist .button:not(#dropdown-toggle) {
  2571. margin-left: 5px;
  2572. }
  2573. #ratings {
  2574. display: flex;
  2575. &.liked #dislike-song,
  2576. &.disliked #like-song {
  2577. background-color: var(--grey) !important;
  2578. }
  2579. #like-song.disabled,
  2580. #dislike-song.disabled {
  2581. filter: grayscale(0.4);
  2582. }
  2583. }
  2584. #add-song-to-playlist {
  2585. display: flex;
  2586. flex-direction: column-reverse;
  2587. #nav-dropdown {
  2588. position: absolute;
  2589. margin-left: 4px;
  2590. margin-bottom: 36px;
  2591. .nav-dropdown-items {
  2592. position: relative;
  2593. right: calc(100% - 110px);
  2594. }
  2595. }
  2596. .control {
  2597. width: fit-content;
  2598. margin-bottom: 0 !important;
  2599. button.disabled {
  2600. filter: grayscale(0.4);
  2601. border-radius: @border-radius;
  2602. &::after {
  2603. margin-right: 100%;
  2604. }
  2605. }
  2606. }
  2607. }
  2608. }
  2609. }
  2610. }
  2611. #sidebar-container {
  2612. border-top: 0;
  2613. position: relative;
  2614. height: inherit;
  2615. flex-grow: 1;
  2616. min-height: 350px;
  2617. }
  2618. }
  2619. }
  2620. .footer {
  2621. margin-top: 30px;
  2622. }
  2623. .nyan {
  2624. background: linear-gradient(
  2625. 90deg,
  2626. magenta 0%,
  2627. red 15%,
  2628. orange 30%,
  2629. yellow 45%,
  2630. lime 60%,
  2631. cyan 75%,
  2632. blue 90%,
  2633. magenta 100%
  2634. );
  2635. background-size: 200%;
  2636. animation: nyanMoving 4s linear infinite;
  2637. }
  2638. @keyframes nyanMoving {
  2639. 0% {
  2640. background-position: 0% 0%;
  2641. }
  2642. 100% {
  2643. background-position: -200% 0%;
  2644. }
  2645. }
  2646. .christmas-seeker {
  2647. background: repeating-linear-gradient(
  2648. -45deg,
  2649. var(--white) 0 1rem,
  2650. var(--dark-red) 1rem 2rem
  2651. );
  2652. background-size: 200% 200%;
  2653. animation: christmas 20s linear infinite;
  2654. }
  2655. @keyframes christmas {
  2656. 100% {
  2657. background-position: 80% 100%;
  2658. }
  2659. }
  2660. .bg-bubbles {
  2661. top: 0;
  2662. left: 0;
  2663. width: 100%;
  2664. height: 100%;
  2665. position: absolute;
  2666. z-index: -1;
  2667. margin: 0px;
  2668. pointer-events: none;
  2669. }
  2670. .bg-bubbles li {
  2671. position: absolute;
  2672. list-style: none;
  2673. display: block;
  2674. width: 40px;
  2675. height: 40px;
  2676. border-radius: 100px;
  2677. background-color: var(--primary-color);
  2678. opacity: 0.15;
  2679. bottom: 0px;
  2680. -webkit-animation: square 25s infinite;
  2681. animation: square 25s infinite;
  2682. -webkit-transition-timing-function: linear;
  2683. transition-timing-function: linear;
  2684. }
  2685. .bg-bubbles li:nth-child(1) {
  2686. left: 10%;
  2687. }
  2688. .bg-bubbles li:nth-child(2) {
  2689. left: 20%;
  2690. width: 80px;
  2691. height: 80px;
  2692. -webkit-animation-delay: 2s;
  2693. animation-delay: 2s;
  2694. -webkit-animation-duration: 17s;
  2695. animation-duration: 17s;
  2696. }
  2697. .bg-bubbles li:nth-child(3) {
  2698. left: 25%;
  2699. -webkit-animation-delay: 4s;
  2700. animation-delay: 4s;
  2701. }
  2702. .bg-bubbles li:nth-child(4) {
  2703. left: 40%;
  2704. width: 60px;
  2705. height: 60px;
  2706. -webkit-animation-duration: 22s;
  2707. animation-duration: 22s;
  2708. background-color: var(--primary-color);
  2709. opacity: 0.25;
  2710. }
  2711. .bg-bubbles li:nth-child(5) {
  2712. left: 70%;
  2713. }
  2714. .bg-bubbles li:nth-child(6) {
  2715. left: 80%;
  2716. width: 120px;
  2717. height: 120px;
  2718. -webkit-animation-delay: 3s;
  2719. animation-delay: 3s;
  2720. background-color: var(--primary-color);
  2721. opacity: 0.2;
  2722. }
  2723. .bg-bubbles li:nth-child(7) {
  2724. left: 32%;
  2725. width: 160px;
  2726. height: 160px;
  2727. -webkit-animation-delay: 7s;
  2728. animation-delay: 7s;
  2729. }
  2730. .bg-bubbles li:nth-child(8) {
  2731. left: 55%;
  2732. width: 20px;
  2733. height: 20px;
  2734. -webkit-animation-delay: 15s;
  2735. animation-delay: 15s;
  2736. -webkit-animation-duration: 40s;
  2737. animation-duration: 40s;
  2738. }
  2739. .bg-bubbles li:nth-child(9) {
  2740. left: 25%;
  2741. width: 10px;
  2742. height: 10px;
  2743. -webkit-animation-delay: 2s;
  2744. animation-delay: 2s;
  2745. -webkit-animation-duration: 40s;
  2746. animation-duration: 40s;
  2747. background-color: var(--primary-color);
  2748. opacity: 0.3;
  2749. }
  2750. .bg-bubbles li:nth-child(10) {
  2751. left: 80%;
  2752. width: 160px;
  2753. height: 160px;
  2754. -webkit-animation-delay: 11s;
  2755. animation-delay: 11s;
  2756. }
  2757. /* Tablet view fix */
  2758. @media (max-width: 768px) {
  2759. .bg-bubbles li:nth-child(10) {
  2760. display: none;
  2761. }
  2762. }
  2763. @-webkit-keyframes square {
  2764. 0% {
  2765. -webkit-transform: translateY(0);
  2766. transform: translateY(0);
  2767. }
  2768. 100% {
  2769. -webkit-transform: translateY(-700px) rotate(600deg);
  2770. transform: translateY(-700px) rotate(600deg);
  2771. }
  2772. }
  2773. @keyframes square {
  2774. 0% {
  2775. -webkit-transform: translateY(0);
  2776. transform: translateY(0);
  2777. }
  2778. 100% {
  2779. -webkit-transform: translateY(-700px) rotate(600deg);
  2780. transform: translateY(-700px) rotate(600deg);
  2781. }
  2782. }
  2783. :deep(.nothing-here-text) {
  2784. display: flex;
  2785. align-items: center;
  2786. justify-content: center;
  2787. }
  2788. @media (min-width: 1500px) {
  2789. #station-left-column {
  2790. max-width: 650px;
  2791. }
  2792. #station-right-column {
  2793. max-width: calc(100% - 650px);
  2794. }
  2795. }
  2796. @media (max-width: 1700px) {
  2797. #current-next-row {
  2798. flex-direction: column !important;
  2799. > div {
  2800. flex: 1 !important;
  2801. }
  2802. }
  2803. }
  2804. @media (max-width: 1500px) {
  2805. #mobile-progress-animation {
  2806. display: block;
  2807. }
  2808. #page-loader-container {
  2809. display: none;
  2810. }
  2811. #station-outer-container {
  2812. max-width: 1500px;
  2813. #station-inner-container {
  2814. flex-direction: row;
  2815. #station-left-column {
  2816. #about-station-container #admin-buttons {
  2817. flex-wrap: wrap;
  2818. }
  2819. #sidebar-container {
  2820. min-height: 350px;
  2821. }
  2822. }
  2823. #station-right-column {
  2824. #current-next-row {
  2825. flex-direction: column;
  2826. }
  2827. #control-bar-container {
  2828. #duration,
  2829. #volume-control,
  2830. #right-buttons,
  2831. #left-buttons {
  2832. margin-bottom: 5px;
  2833. justify-content: center;
  2834. }
  2835. #duration {
  2836. order: 1;
  2837. }
  2838. #volume-control {
  2839. order: 2;
  2840. max-width: 400px;
  2841. }
  2842. #right-buttons {
  2843. order: 3;
  2844. flex-wrap: wrap;
  2845. #ratings {
  2846. flex-wrap: wrap;
  2847. }
  2848. }
  2849. #left-buttons {
  2850. order: 4;
  2851. flex-wrap: wrap;
  2852. }
  2853. }
  2854. }
  2855. }
  2856. }
  2857. }
  2858. @media (max-width: 1200px) {
  2859. #station-outer-container {
  2860. max-width: 900px;
  2861. padding: 0;
  2862. #station-inner-container {
  2863. flex-direction: column-reverse;
  2864. flex-wrap: nowrap;
  2865. }
  2866. }
  2867. }
  2868. @media (max-width: 990px) {
  2869. #station-outer-container {
  2870. min-height: calc(
  2871. 100vh - 256px
  2872. ); // Height of nav (64px) + height of footer (190px)
  2873. }
  2874. }
  2875. </style>