index.vue 65 KB

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