mirror of
				https://github.com/TeamPiped/Piped.git
				synced 2024-08-14 23:57:27 +00:00 
			
		
		
		
	player: add videoonly check
This commit is contained in:
		
							parent
							
								
									eea94f9809
								
							
						
					
					
						commit
						8eec6b2d49
					
				
					 1 changed files with 30 additions and 13 deletions
				
			
		| 
						 | 
				
			
			@ -216,7 +216,23 @@ export default {
 | 
			
		|||
                        })
 | 
			
		||||
                    );
 | 
			
		||||
 | 
			
		||||
                    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"
 | 
			
		||||
                        });
 | 
			
		||||
                    });
 | 
			
		||||
 | 
			
		||||
                    this.player.src(src);
 | 
			
		||||
 | 
			
		||||
                    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
 | 
			
		||||
| 
						 | 
				
			
			@ -226,8 +242,6 @@ export default {
 | 
			
		|||
                                -1
 | 
			
		||||
                            )[0].url;
 | 
			
		||||
 | 
			
		||||
                    this.player.src(src);
 | 
			
		||||
 | 
			
		||||
                    if (noPrevPlayer) {
 | 
			
		||||
                        this.player.on("timeupdate", () => {
 | 
			
		||||
                            if (this.sponsors && this.sponsors.segments) {
 | 
			
		||||
| 
						 | 
				
			
			@ -240,6 +254,7 @@ export default {
 | 
			
		|||
                                            time < end
 | 
			
		||||
                                        ) {
 | 
			
		||||
                                            this.player.currentTime(end);
 | 
			
		||||
                                            if (this.audioplayer)
 | 
			
		||||
                                                this.audioplayer.currentTime = end;
 | 
			
		||||
                                            segment.skipped = true;
 | 
			
		||||
                                            return;
 | 
			
		||||
| 
						 | 
				
			
			@ -266,12 +281,14 @@ export default {
 | 
			
		|||
                        });
 | 
			
		||||
 | 
			
		||||
                        this.player.on("play", () => {
 | 
			
		||||
                            this.audioplayer.play();
 | 
			
		||||
                            if (this.audioplayer) this.audioplayer.play();
 | 
			
		||||
                        });
 | 
			
		||||
 | 
			
		||||
                        this.player.on("pause", () => {
 | 
			
		||||
                            if (this.audioplayer) {
 | 
			
		||||
                                this.audioplayer.currentTime = this.player.currentTime();
 | 
			
		||||
                                this.audioplayer.pause();
 | 
			
		||||
                            }
 | 
			
		||||
                        });
 | 
			
		||||
 | 
			
		||||
                        this.player.on("volumechange", () => {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue