mirror of
				https://github.com/TeamPiped/Piped.git
				synced 2025-10-31 12:42:07 +00:00 
			
		
		
		
	player: add videoonly check
This commit is contained in:
		| @@ -213,20 +213,34 @@ export default { | |||||||
|                                 src: stream.url, |                                 src: stream.url, | ||||||
|                                 type: stream.mimeType, |                                 type: stream.mimeType, | ||||||
|                                 label: stream.quality |                                 label: stream.quality | ||||||
|                             }) |                         }) | ||||||
|                         ); |                     ); | ||||||
|  |  | ||||||
|  |                     this.video.subtitles.map(subtitle => { | ||||||
|  |                         this.player.addRemoteTextTrack({ | ||||||
|  |                             kind: "captions", | ||||||
|  |                             src: subtitle.url.replace("fmt=ttml", "fmt=vtt"), | ||||||
|  |                             label: "Track", | ||||||
|  |                             language: "en", | ||||||
|  |                             type: "captions/captions.vtt" | ||||||
|  |                         }); | ||||||
|  |                     }); | ||||||
|  |  | ||||||
|                     if (!this.audioplayer) |                     this.player.src(src); | ||||||
|                         this.audioplayer = new Audio( |  | ||||||
|                             this.video.audioStreams.slice(-1)[0].url |                     const currentSrc = src.filter( | ||||||
|  |                         src => src.src == this.player.currentSrc() | ||||||
|  |                     )[0]; | ||||||
|  |  | ||||||
|  |                     if (currentSrc.videoOnly) | ||||||
|  |                         if (!this.audioplayer) | ||||||
|  |                             this.audioplayer = new Audio( | ||||||
|  |                                 this.video.audioStreams.slice(-1)[0].url | ||||||
|                         ); |                         ); | ||||||
|                     else |                     else | ||||||
|                         this.audioplayer.src = this.video.audioStreams.slice( |                         this.audioplayer.src = this.video.audioStreams.slice( | ||||||
|                             -1 |                                 -1 | ||||||
|                         )[0].url; |                             )[0].url; | ||||||
|  |  | ||||||
|                     this.player.src(src); |  | ||||||
|  |  | ||||||
|                     if (noPrevPlayer) { |                     if (noPrevPlayer) { | ||||||
|                         this.player.on("timeupdate", () => { |                         this.player.on("timeupdate", () => { | ||||||
| @@ -240,7 +254,8 @@ export default { | |||||||
|                                             time < end |                                             time < end | ||||||
|                                         ) { |                                         ) { | ||||||
|                                             this.player.currentTime(end); |                                             this.player.currentTime(end); | ||||||
|                                             this.audioplayer.currentTime = end; |                                             if (this.audioplayer) | ||||||
|  |                                                 this.audioplayer.currentTime = end; | ||||||
|                                             segment.skipped = true; |                                             segment.skipped = true; | ||||||
|                                             return; |                                             return; | ||||||
|                                         } |                                         } | ||||||
| @@ -266,12 +281,14 @@ export default { | |||||||
|                         }); |                         }); | ||||||
|  |  | ||||||
|                         this.player.on("play", () => { |                         this.player.on("play", () => { | ||||||
|                             this.audioplayer.play(); |                             if (this.audioplayer) this.audioplayer.play(); | ||||||
|                         }); |                         }); | ||||||
|  |  | ||||||
|                         this.player.on("pause", () => { |                         this.player.on("pause", () => { | ||||||
|                             this.audioplayer.currentTime = this.player.currentTime(); |                             if (this.audioplayer) { | ||||||
|                             this.audioplayer.pause(); |                                 this.audioplayer.currentTime = this.player.currentTime(); | ||||||
|  |                                 this.audioplayer.pause(); | ||||||
|  |                             } | ||||||
|                         }); |                         }); | ||||||
|  |  | ||||||
|                         this.player.on("volumechange", () => { |                         this.player.on("volumechange", () => { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 FireMasterK
					FireMasterK