index.vue 64 KB

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