index.vue 71 KB

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