Fix video playback on iOS
This commit is contained in:
		
							parent
							
								
									06945f433b
								
							
						
					
					
						commit
						2977972274
					
				| 
						 | 
				
			
			@ -1,9 +1,10 @@
 | 
			
		|||
function playVideo(overlay) {
 | 
			
		||||
    const video = overlay.parentElement.querySelector('video');
 | 
			
		||||
    const url = video.getAttribute("data-url");
 | 
			
		||||
    video.setAttribute("controls", "");
 | 
			
		||||
    overlay.style.display = "none";
 | 
			
		||||
 | 
			
		||||
    const url = video.getAttribute("data-url");
 | 
			
		||||
    if (Hls.isSupported()) {
 | 
			
		||||
        var hls = new Hls({autoStartLoad: false});
 | 
			
		||||
        hls.loadSource(url);
 | 
			
		||||
        hls.attachMedia(video);
 | 
			
		||||
| 
						 | 
				
			
			@ -12,4 +13,10 @@ function playVideo(overlay) {
 | 
			
		|||
            hls.startLoad();
 | 
			
		||||
            video.play();
 | 
			
		||||
        });
 | 
			
		||||
    } else if (video.canPlayType('application/vnd.apple.mpegurl')) {
 | 
			
		||||
        video.src = url;
 | 
			
		||||
        video.addEventListened('canplay', function() {
 | 
			
		||||
            video.play();
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue