mStream/public/shared.html
2017-04-12 19:50:44 -04:00

186 lines
7.4 KiB
HTML

<head>
<!-- mStream CSS -->
<link rel="stylesheet" href="/public/css/shared.css">
<link rel="stylesheet" href="/public/css/mstream-player.css">
<!-- Pure CSS -->
<link rel="stylesheet" href="https://unpkg.com/purecss@0.6.1/build/pure-min.css" integrity="sha384-CCTZv2q9I9m3UOxRLaJneXrrqKwUNOzZ6NGEUMwHtShDJ+nCoiXJCAgi05KfkLGY" crossorigin="anonymous">
<!-- jQuery, because I'm too lazy to write vanilla AJAX -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<!-- Vue JS -->
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<!-- Sortable JS -->
<script src="https://unpkg.com/sortablejs@latest"></script>
<!-- https://github.com/SortableJS/Vue.Draggable - v2.6 -->
<script src="/public/js/lib/vue-sortable.js"></script>
<link rel="stylesheet" media="screen" href="https://fontlibrary.org/face/8bit-wonder" type="text/css"/>
<link rel="apple-touch-icon" sizes="57x57" href="/public/favicon/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/public/favicon/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/public/favicon/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/public/favicon/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/public/favicon/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/public/favicon/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/public/favicon/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/public/favicon/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/public/favicon/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/public/favicon/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="/public/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/public/favicon/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/public/favicon/favicon-16x16.png">
<link rel="manifest" href="/public/favicon/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/public/favicon/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<!--
This is the mStream Player stack
DO NOT Change to order these are loaded in
You do not need to worry about how these work
-->
<script src="/public/js/lib/aurora.js"></script>
<script src="/public/js/lib/flac.js"></script>
<script src="/public/js/lib/howler.core.min.js"></script>
<script src="/public/js/mstream.player.js"></script>
<!-- <script src="/public/js/mstream.api.js"></script> -->
<script src="/public/js/mstream.vue-player-controls.js"></script>
<script>
window.onload = function(){
// TODO: Handle metatdata
// invoke vueplayer
VUEPLAYER();
// Get token from url
var path = window.location.pathname;
var uuid = path.split("/").pop();
// // Call Server
var request = $.ajax({
url: "/shared/get-token-and-playlist",
type: "POST",
contentType: "application/json",
dataType: "json",
data: JSON.stringify({tokenid: uuid})
});
//
request.done(function( msg ) {
var decoded = msg;
var playlist = decoded.playlist;
var vpath = '';
if(decoded.vPath){
vpath = '/' + decoded.vPath;
}
// Get playlist
for (var i = 0; i < playlist.length; i++) {
MSTREAMPLAYER.addSong(
{
url: vpath + '/' + playlist[i] + '?token=' + decoded.token,
filepath: playlist[i],
metadata: {
"artist": "",
"album": "",
"track": "",
"title": "",
"year": "",
"album-art": ""
}
}
);
}
// Add playlist to mstream
});
request.fail(function( jqXHR, textStatus ) {
// TODO: Alert user
});
}
</script>
</head>
<body>
<!-- Header -->
<div class="header">
<div class="logo-box">
<img class="mstream-image" src="/public/img/mstream-logo.svg">
</div>
</div>
<!-- Playlist Header -->
<div class="playlist-header">
<div class="playlist-header-text">Now Playing</div>
<div class="button-group">
<div class="repeat"></div>
<div></div>
<div></div>
</div>
</div>
<!-- Playlist -->
<div class="playlist-container">
<draggable :list="playlist" @end="checkMove" id="playlist">
<div v-for="(song, index) in playlist" is="playlist-item" :key="index" :index="index" :song="song">
</div>
</draggable>
</div>
<!-- Controls -->
<div id="mstream-player" class="mstream-player">
<div id="previous-button" class="previous-button">
<img class="previous-image center" src="/public/img/previous-white.svg">
</div>
<div id="play-pause-button" class="play-pause-button">
<img id="play-pause-image" class="play-pause-image center" :src="imgsrc">
</div>
<div id="next-button" class="next-button">
<img class="mext-image center" src="/public/img/next-white.svg">
</div>
<div id="progress-bar" class="progress-bar">
<div class="titlebar">
<div id="title-text" class="title-text">{{currentSongText}}</div>
</div>
<div class="pbar" :style="widthcss"></div>
</div>
<div class="right-group">
<div class="duration-text">{{showTime}}</div>
<div class="aux-button-group">
<!-- For precise control we have to have the svg code embedded in the html -->
<!-- <img v-on:click="toggleRepeat" v-bind:class="{ 'aux-button-active': playerStats.shouldLoop }" class="repeat-button" src="/public/img/repeat-white.svg"> -->
<!-- <img class="shuffle-button" src="/public/img/shuffle-white.svg"> -->
<svg v-on:click="toggleRepeat" v-bind:class="{ 'aux-button-active': playerStats.shouldLoop }" class="repeat-button" xmlns="http://www.w3.org/2000/svg" version="1" viewBox="0 0 24 24" enable-background="new 0 0 24 24" width="25" height="25">
<path d="M 17 2 L 17 5 L 6 5 C 4.3 5 3 6.3 3 8 L 3 14.8125 L 5 13.1875 L 5 8 C 5 7.4 5.4 7 6 7 L 17 7 L 17 10 L 22 6 L 17 2 z M 21 9.1875 L 19 10.8125 L 19 16 C 19 16.6 18.6 17 18 17 L 7 17 L 7 14 L 2 18 L 7 22 L 7 19 L 18 19 C 19.7 19 21 17.7 21 16 L 21 9.1875 z"/>
</svg>
<svg class="shuffle-button" v-on:click="toggleShuffle" v-bind:class="{ 'aux-button-active': playerStats.shuffle }" xmlns="http://www.w3.org/2000/svg" version="1" viewBox="0 0 24 24" enable-background="new 0 0 24 24" width="25" height="25" >
<path d="M 17 2 L 17 5 L 14.1875 5 C 13.0875 5 12 5.5875 11.5 6.6875 L 6.59375 16.5 C 6.49375 16.8 6.1125 17 5.8125 17 L 2 17 L 2 19 L 5.8125 19 C 6.9125 19 8 18.4125 8.5 17.3125 L 13.40625 7.5 C 13.50625 7.2 13.8875 7 14.1875 7 L 17 7 L 17 10 L 22 6 L 17 2 z M 2 5 L 2 7 L 5.8125 7 C 6.1125 7 6.4875 7.19375 6.6875 7.59375 L 8.40625 10.90625 L 9.5 8.6875 L 8.5 6.6875 C 7.9 5.5875 6.9125 5 5.8125 5 L 2 5 z M 11.59375 13.09375 L 10.5 15.3125 L 11.5 17.3125 C 12 18.3125 12.9875 19 14.1875 19 L 17 19 L 17 22 L 22 18 L 17 14 L 17 17 L 14.1875 17 C 13.8875 17 13.5125 16.80625 13.3125 16.40625 L 11.59375 13.09375 z"/>
</svg>
</div>
</div>
</div>
</body>