index.vue 73 KB

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