mirror of
				https://github.com/TeamPiped/Piped.git
				synced 2024-08-14 23:57:27 +00:00 
			
		
		
		
	Load shaka-player as soon as Player component is loaded.
This commit is contained in:
		
							parent
							
								
									574740020a
								
							
						
					
					
						commit
						3d3b587a9c
					
				
					 1 changed files with 22 additions and 22 deletions
				
			
		| 
						 | 
					@ -39,6 +39,9 @@ export default {
 | 
				
			||||||
            return _this.getPreferenceBoolean("playerAutoPlay", true);
 | 
					            return _this.getPreferenceBoolean("playerAutoPlay", true);
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    mounted() {
 | 
				
			||||||
 | 
					        if (!this.shaka) this.shakaPromise = shaka.then(shaka => shaka.default).then(shaka => (this.shaka = shaka));
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    methods: {
 | 
					    methods: {
 | 
				
			||||||
        loadVideo() {
 | 
					        loadVideo() {
 | 
				
			||||||
            const component = this;
 | 
					            const component = this;
 | 
				
			||||||
| 
						 | 
					@ -73,13 +76,10 @@ export default {
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (noPrevPlayer)
 | 
					            if (noPrevPlayer)
 | 
				
			||||||
                shaka
 | 
					                this.shakaPromise.then(() => {
 | 
				
			||||||
                    .then(shaka => shaka.default)
 | 
					                    this.shaka.polyfill.installAll();
 | 
				
			||||||
                    .then(shaka => {
 | 
					 | 
				
			||||||
                        this.shaka = shaka;
 | 
					 | 
				
			||||||
                        shaka.polyfill.installAll();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        const localPlayer = new shaka.Player(videoEl);
 | 
					                    const localPlayer = new this.shaka.Player(videoEl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    localPlayer.getNetworkingEngine().registerRequestFilter((_type, request) => {
 | 
					                    localPlayer.getNetworkingEngine().registerRequestFilter((_type, request) => {
 | 
				
			||||||
                        const uri = request.uris[0];
 | 
					                        const uri = request.uris[0];
 | 
				
			||||||
| 
						 | 
					@ -96,7 +96,7 @@ export default {
 | 
				
			||||||
                        Math.max(this.getPreferenceNumber("bufferGoal", 10), 10),
 | 
					                        Math.max(this.getPreferenceNumber("bufferGoal", 10), 10),
 | 
				
			||||||
                    );
 | 
					                    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        this.setPlayerAttrs(localPlayer, videoEl, uri, shaka);
 | 
					                    this.setPlayerAttrs(localPlayer, videoEl, uri, this.shaka);
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
            else this.setPlayerAttrs(this.player, videoEl, uri, this.shaka);
 | 
					            else this.setPlayerAttrs(this.player, videoEl, uri, this.shaka);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue