mirror of
https://github.com/SuperBFG7/ympd
synced 2025-03-15 16:08:19 +00:00
Fixed local player
- separated js from html - no cookies
This commit is contained in:
parent
39e963804e
commit
4fdacde42a
@ -31,7 +31,7 @@
|
||||
<div class="dropdown-divider"></div>
|
||||
<a id="nav-addstream" class="dropdown-item text-light bg-dark" href="#" data-toggle="modal" data-target="#addstream">Add Stream</a>
|
||||
<a id="nav-updatedb" class="dropdown-item text-light bg-dark" href="#" onclick="updateDB(event);">Update Database</a>
|
||||
<a id="nav-localplayer" class="dropdown-item text-light bg-dark" href="#" data-toggle="dropdown" onclick="window.open('/player.html','LocalPlayer');">Local Player</a>
|
||||
<a id="nav-localplayer" class="dropdown-item text-light bg-dark" href="#" data-toggle="dropdown" onclick="window.open('/player.html#'+settings.mpdstream,'LocalPlayer');">Local Player</a>
|
||||
<a id="nav-settings" class="dropdown-item text-light bg-dark" href="#" data-toggle="modal" data-target="#settings">Settings</a>
|
||||
<a id="nav-about" class="dropdown-item text-light bg-dark" href="#" data-toggle="modal" data-target="#about">About</a>
|
||||
</div>
|
||||
|
@ -33,7 +33,7 @@ var playstate = '';
|
||||
var progressBar;
|
||||
var volumeBar;
|
||||
var coverImageFile = '';
|
||||
var settings = { "notifyPage":1, "notifyWeb": 0 };
|
||||
var settings = { "notifyPage":1, "notifyWeb": 0, "mpdstream":"" };
|
||||
|
||||
var app = {};
|
||||
|
||||
@ -80,22 +80,25 @@ app.prepare=function() {
|
||||
}
|
||||
|
||||
app.goto=function(a,t,v,s) {
|
||||
var hash='';
|
||||
if (app.apps[a].tabs) {
|
||||
if (t == undefined) t = app.apps[a].active;
|
||||
if (app.apps[a].tabs[t].views) {
|
||||
if (v == undefined) v = app.apps[a].tabs[t].active;
|
||||
location.hash = '/'+a+'/'+t+'/'+v+'!'+ (s == undefined ? app.apps[a].tabs[t].views[v].state : s);
|
||||
hash = '/'+a+'/'+t+'/'+v+'!'+ (s == undefined ? app.apps[a].tabs[t].views[v].state : s);
|
||||
} else {
|
||||
location.hash = '/'+a+'/'+t+'!'+ (s == undefined ? app.apps[a].tabs[t].state : s);
|
||||
hash = '/'+a+'/'+t+'!'+ (s == undefined ? app.apps[a].tabs[t].state : s);
|
||||
}
|
||||
} else {
|
||||
location.hash = '/'+a+'!'+ (s == undefined ? app.apps[a].state : s);
|
||||
hash = '/'+a+'!'+ (s == undefined ? app.apps[a].state : s);
|
||||
}
|
||||
location.hash=hash;
|
||||
}
|
||||
|
||||
app.route=function() {
|
||||
var hash=decodeURI(location.hash);
|
||||
if (params=hash.match(/^\#\/(\w+)\/?(\w+)?\/?(\w+)?\!((\d+)\/([^\/]+)\/(.*))$/)) {
|
||||
if (params=hash.match(/^\#\/(\w+)\/?(\w+)?\/?(\w+)?\!((\d+)\/([^\/]+)\/(.*))$/))
|
||||
{
|
||||
app.current.app = params[1];
|
||||
app.current.tab = params[2];
|
||||
app.current.view = params[3];
|
||||
@ -963,7 +966,8 @@ function setLocalStream(mpdhost,streamport) {
|
||||
else
|
||||
mpdstream += mpdhost;
|
||||
mpdstream += ':'+streamport+'/';
|
||||
Cookies.set('mpdstream', mpdstream, { expires: 424242 });
|
||||
settings.mpdstream=mpdstream;
|
||||
// Cookies.set('mpdstream', mpdstream, { expires: 424242 });
|
||||
}
|
||||
|
||||
function delQueueSong(tr,event) {
|
||||
|
5
htdocs/js/player.js
Normal file
5
htdocs/js/player.js
Normal file
@ -0,0 +1,5 @@
|
||||
var mpdstream = decodeURI(location.hash).replace(/^#/,'');
|
||||
player.src = mpdstream;
|
||||
console.log('playing mpd stream: ' + player.src);
|
||||
player.load();
|
||||
player.play();
|
@ -30,14 +30,7 @@
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script src="js/jquery-3.3.1.min.js"></script>
|
||||
<script src="js/js.cookie.js"></script>
|
||||
<script type="text/javascript">
|
||||
var mpdstream = Cookies.get('mpdstream');
|
||||
player.src = mpdstream;
|
||||
console.log('playing mpd stream: ' + player.src);
|
||||
player.load();
|
||||
player.play();
|
||||
</script>
|
||||
<script type="text/javascript" src="js/js.cookie-2.2.0.min.js"></script>
|
||||
<script type="text/javascript" src="js/player.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
x
Reference in New Issue
Block a user