index.vue 73 KB

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