mirror of
				https://github.com/SuperBFG7/ympd
				synced 2025-10-31 05:43:01 +00:00 
			
		
		
		
	Fixed local player
- separated js from html - no cookies
This commit is contained in:
		| @@ -31,7 +31,7 @@ | |||||||
|             <div class="dropdown-divider"></div> |             <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-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-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-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> |             <a id="nav-about" class="dropdown-item text-light bg-dark" href="#" data-toggle="modal" data-target="#about">About</a> | ||||||
|           </div> |           </div> | ||||||
|   | |||||||
| @@ -33,7 +33,7 @@ var playstate = ''; | |||||||
| var progressBar; | var progressBar; | ||||||
| var volumeBar; | var volumeBar; | ||||||
| var coverImageFile = ''; | var coverImageFile = ''; | ||||||
| var settings = { "notifyPage":1, "notifyWeb": 0 }; | var settings = { "notifyPage":1, "notifyWeb": 0, "mpdstream":"" }; | ||||||
|  |  | ||||||
| var app = {}; | var app = {}; | ||||||
|  |  | ||||||
| @@ -80,22 +80,25 @@ app.prepare=function() { | |||||||
| } | } | ||||||
|  |  | ||||||
| app.goto=function(a,t,v,s) { | app.goto=function(a,t,v,s) { | ||||||
|  |    var hash=''; | ||||||
|    if (app.apps[a].tabs) { |    if (app.apps[a].tabs) { | ||||||
|      if (t == undefined) t = app.apps[a].active; |      if (t == undefined) t = app.apps[a].active; | ||||||
|      if (app.apps[a].tabs[t].views) { |      if (app.apps[a].tabs[t].views) { | ||||||
|        if (v == undefined) v = app.apps[a].tabs[t].active; |        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 { |      } 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 { |    } 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() { | app.route=function() { | ||||||
|     var hash=decodeURI(location.hash); |     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.app = params[1]; | ||||||
|       app.current.tab = params[2]; |       app.current.tab = params[2]; | ||||||
|       app.current.view = params[3]; |       app.current.view = params[3]; | ||||||
| @@ -963,7 +966,8 @@ function setLocalStream(mpdhost,streamport) { | |||||||
|     else |     else | ||||||
|         mpdstream += mpdhost; |         mpdstream += mpdhost; | ||||||
|     mpdstream += ':'+streamport+'/'; |     mpdstream += ':'+streamport+'/'; | ||||||
|     Cookies.set('mpdstream', mpdstream, { expires: 424242 }); |     settings.mpdstream=mpdstream; | ||||||
|  | //    Cookies.set('mpdstream', mpdstream, { expires: 424242 }); | ||||||
| } | } | ||||||
|  |  | ||||||
| function delQueueSong(tr,event) { | 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> |     </div> | ||||||
|   </main> |   </main> | ||||||
|  |  | ||||||
|   <script src="js/jquery-3.3.1.min.js"></script> |   <script type="text/javascript" src="js/js.cookie-2.2.0.min.js"></script> | ||||||
|   <script src="js/js.cookie.js"></script> | <script type="text/javascript" src="js/player.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>   |  | ||||||
| </body> | </body> | ||||||
| </html> | </html> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 jcorporation
					jcorporation