mirror of
				https://github.com/KevinMidboe/zoff.git
				synced 2025-10-29 18:00:23 +00:00 
			
		
		
		
	Paused, embed and includes
- Fixed issue with paused video playing on changing song for others - Fixed more embedoptions - cueVideoById is a neat function that I should have used earlier - Added smaller jquery.ui files
This commit is contained in:
		| @@ -295,6 +295,7 @@ | |||||||
|   outline: none; |   outline: none; | ||||||
|   border: none; |   border: none; | ||||||
|   margin-left: -7.5px; |   margin-left: -7.5px; | ||||||
|  |   margin-top: 0; | ||||||
|   border-radius: 1000px; |   border-radius: 1000px; | ||||||
|   transition: background 0.2s ease, box-shadow 0.2s ease; |   transition: background 0.2s ease, box-shadow 0.2s ease; | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										7
									
								
								server/public/assets/css/jquery-ui.min.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								server/public/assets/css/jquery-ui.min.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										10
									
								
								server/public/assets/dist/lib/jquery-ui.min.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								server/public/assets/dist/lib/jquery-ui.min.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -44,8 +44,10 @@ var Player = { | |||||||
|             startTime = time - conf.startTime; |             startTime = time - conf.startTime; | ||||||
|             song_title = obj.np[0].title; |             song_title = obj.np[0].title; | ||||||
|             duration   = obj.np[0].duration; |             duration   = obj.np[0].duration; | ||||||
|             Player.loadVideoById(video_id, duration); |             if(player_ready) { | ||||||
|             Player.stopVideo(); |                 Player.cueVideoById(video_id, duration); | ||||||
|  |                 Player.stopVideo(); | ||||||
|  |             } | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         if(embed && obj.np) { |         if(embed && obj.np) { | ||||||
| @@ -76,9 +78,7 @@ var Player = { | |||||||
|                 "mobile_beginning variable: " + mobile_beginning]); |                 "mobile_beginning variable: " + mobile_beginning]); | ||||||
|             try{ |             try{ | ||||||
|                 Helper.log(["getVideoUrl(): " + Player.player.getVideoUrl().split('v=')[1]]); |                 Helper.log(["getVideoUrl(): " + Player.player.getVideoUrl().split('v=')[1]]); | ||||||
|             } catch(e){ |             } catch(e){} | ||||||
|  |  | ||||||
|             } |  | ||||||
|             Helper.log(["video_id variable: " + video_id]); |             Helper.log(["video_id variable: " + video_id]); | ||||||
|             if(!obj.np){ |             if(!obj.np){ | ||||||
|                 $('#song-title').html("Empty channel. Add some songs!"); |                 $('#song-title').html("Empty channel. Add some songs!"); | ||||||
| @@ -99,7 +99,8 @@ var Player = { | |||||||
|  |  | ||||||
|                 } |                 } | ||||||
|                 //List.importOldList(channel.toLowerCase()); |                 //List.importOldList(channel.toLowerCase()); | ||||||
|             } else if(paused){ |             } else if(paused || was_stopped){ | ||||||
|  |  | ||||||
|                 Player.getTitle(obj.np[0].title, viewers); |                 Player.getTitle(obj.np[0].title, viewers); | ||||||
|                 //Player.setBGimage(video_id); |                 //Player.setBGimage(video_id); | ||||||
|                 if(!Helper.mobilecheck()) { |                 if(!Helper.mobilecheck()) { | ||||||
| @@ -128,6 +129,7 @@ var Player = { | |||||||
|                 startTime = time - conf.startTime; |                 startTime = time - conf.startTime; | ||||||
|                 song_title = obj.np[0].title; |                 song_title = obj.np[0].title; | ||||||
|                 duration   = obj.np[0].duration; |                 duration   = obj.np[0].duration; | ||||||
|  |                 Player.cueVideoById(video_id, duration); | ||||||
|                 //Player.setBGimage(video_id); |                 //Player.setBGimage(video_id); | ||||||
|             } else if(!paused){ |             } else if(!paused){ | ||||||
|                 //Helper.log("gotten new song"); |                 //Helper.log("gotten new song"); | ||||||
| @@ -187,14 +189,15 @@ var Player = { | |||||||
|                         } else { |                         } else { | ||||||
|                             if(compared || chromecastAvailable){ |                             if(compared || chromecastAvailable){ | ||||||
|  |  | ||||||
|                                 Player.loadVideoById(video_id, duration); |                                 if(paused && !chromecastAvailable){ | ||||||
|  |                                     Player.cueVideoById(video_id, duration); | ||||||
|  |                                 } else { | ||||||
|  |                                     Player.loadVideoById(video_id, duration); | ||||||
|  |                                     Player.seekTo(seekTo); | ||||||
|  |                                 } | ||||||
|                                 if(!Helper.mobilecheck()) { |                                 if(!Helper.mobilecheck()) { | ||||||
|                                     Player.notifyUser(video_id, song_title); |                                     Player.notifyUser(video_id, song_title); | ||||||
|                                 } |                                 } | ||||||
|                                 Player.seekTo(seekTo); |  | ||||||
|                                 if(paused && !chromecastAvailable){ |  | ||||||
|                                     Player.pauseVideo(); |  | ||||||
|                                 } |  | ||||||
|                             } |                             } | ||||||
|                             if(!paused){ |                             if(!paused){ | ||||||
|                                 if(((!mobile_beginning || chromecastAvailable) && prev_state != 2) && autoplay) { |                                 if(((!mobile_beginning || chromecastAvailable) && prev_state != 2) && autoplay) { | ||||||
| @@ -215,7 +218,7 @@ var Player = { | |||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
|                     }catch(e) { |                     }catch(e) { | ||||||
|                         if(chromecastAvailable) { |                         if(chromecastAvailable && !paused) { | ||||||
|                             Player.loadVideoById(video_id, duration); |                             Player.loadVideoById(video_id, duration); | ||||||
|                             Player.seekTo(seekTo); |                             Player.seekTo(seekTo); | ||||||
|                         } |                         } | ||||||
| @@ -397,6 +400,18 @@ var Player = { | |||||||
|         } |         } | ||||||
|     }, |     }, | ||||||
|  |  | ||||||
|  |     cueVideoById: function(id, this_duration, start, end){ | ||||||
|  |         var s; | ||||||
|  |         var e; | ||||||
|  |         if(start) s = start; | ||||||
|  |         else s = Player.np.start; | ||||||
|  |         if(end) e = end; | ||||||
|  |         else e = Player.np.end; | ||||||
|  |  | ||||||
|  |         Player.player.cueVideoById({'videoId': id, 'startSeconds': s, 'endSeconds': e}); | ||||||
|  |  | ||||||
|  |     }, | ||||||
|  |  | ||||||
|     stopVideo: function(){ |     stopVideo: function(){ | ||||||
|         if(chromecastAvailable){ |         if(chromecastAvailable){ | ||||||
|             castSession.sendMessage("urn:x-cast:zoff.me", {type: "stopVideo"}); |             castSession.sendMessage("urn:x-cast:zoff.me", {type: "stopVideo"}); | ||||||
| @@ -561,21 +576,25 @@ var Player = { | |||||||
|                 $(".video-container").removeClass("no-opacity"); |                 $(".video-container").removeClass("no-opacity"); | ||||||
|                 $("#controls").css("opacity", "1"); |                 $("#controls").css("opacity", "1"); | ||||||
|                 $(".playlist").css("opacity", "1"); |                 $(".playlist").css("opacity", "1"); | ||||||
|                 Player.loadVideoById(video_id, duration); |                 if(autoplay) { | ||||||
|  |                     Player.loadVideoById(video_id, duration); | ||||||
|  |                 } else { | ||||||
|  |                     Player.cueVideoById(video_id, duration); | ||||||
|  |                 } | ||||||
|                 if(autoplay && (!Helper.mobilecheck() || chromecastAvailable)) { |                 if(autoplay && (!Helper.mobilecheck() || chromecastAvailable)) { | ||||||
|                     Player.playVideo(); |                     //Player.playVideo(); | ||||||
|                 } |                 } | ||||||
|                 if(!durationBegun) { |                 if(!durationBegun) { | ||||||
|                     Player.durationSetter(); |                     Player.durationSetter(); | ||||||
|                 } |                 } | ||||||
|                 if(embed){ |                 if(embed){ | ||||||
|                     setTimeout(function(){ |                     //setTimeout(function(){ | ||||||
|                         Player.player.seekTo(seekTo); |                         //Player.player.seekTo(seekTo); | ||||||
|                         if(!autoplay){ |                         if(!autoplay){ | ||||||
|                             Player.player.pauseVideo(); |                             Player.player.stopVideo(); | ||||||
|                             Playercontrols.play_pause_show(); |                             Playercontrols.play_pause_show(); | ||||||
|                         } |                         } | ||||||
|                     }, 1000); |                     //}, 1000); | ||||||
|                 }else |                 }else | ||||||
|                 Player.seekTo(seekTo); |                 Player.seekTo(seekTo); | ||||||
|             } |             } | ||||||
|   | |||||||
| @@ -33,6 +33,7 @@ | |||||||
|             <link rel="icon" id="favicon" type="image/png" sizes="16x16" href="/assets/images/favicon-16x16.png"> |             <link rel="icon" id="favicon" type="image/png" sizes="16x16" href="/assets/images/favicon-16x16.png"> | ||||||
|             <link rel="mask-icon" href="/assets/images/safari-pinned-tab.svg" color="#2d2d2d"> |             <link rel="mask-icon" href="/assets/images/safari-pinned-tab.svg" color="#2d2d2d"> | ||||||
|         {{/if}} |         {{/if}} | ||||||
|  |         <link rel="stylesheet" href="/assets/css/jquery-ui.min.css"> | ||||||
|         <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css"> |         <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css"> | ||||||
|         <link rel="stylesheet" type="text/css" href="/assets/css/{{stylesheet}}" title="Default" /> |         <link rel="stylesheet" type="text/css" href="/assets/css/{{stylesheet}}" title="Default" /> | ||||||
|         <script type="text/javascript" src="https://code.jquery.com/jquery-2.2.4.min.js"></script> |         <script type="text/javascript" src="https://code.jquery.com/jquery-2.2.4.min.js"></script> | ||||||
| @@ -43,7 +44,6 @@ | |||||||
|         {{else}} |         {{else}} | ||||||
|             <script src="https://cdnjs.cloudflare.com/ajax/libs/spectrum/1.8.0/spectrum.min.js"></script> |             <script src="https://cdnjs.cloudflare.com/ajax/libs/spectrum/1.8.0/spectrum.min.js"></script> | ||||||
|             <script type="text/javascript" src="https://swisnl.github.io/jQuery-contextMenu/dist/jquery.contextMenu.js"></script> |             <script type="text/javascript" src="https://swisnl.github.io/jQuery-contextMenu/dist/jquery.contextMenu.js"></script> | ||||||
|             <script type="text/javascript" src="https://swisnl.github.io/jQuery-contextMenu/dist/jquery.ui.position.min.js"></script> |  | ||||||
|             <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js"></script> |             <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js"></script> | ||||||
|             <script type="text/javascript"> |             <script type="text/javascript"> | ||||||
|                 if(window.location.hostname != "localhost") { |                 if(window.location.hostname != "localhost") { | ||||||
| @@ -55,7 +55,7 @@ | |||||||
|                     ga('create', '{{{ analytics }}}', 'auto'); |                     ga('create', '{{{ analytics }}}', 'auto'); | ||||||
|                 } else { |                 } else { | ||||||
|                     function ga() { |                     function ga() { | ||||||
|                         console.log(arguments); |                          | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             </script> |             </script> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user