index.vue 65 KB

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