index.vue 65 KB

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