Skip to content

Commit

Permalink
Fix video playback on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
zedeus committed Nov 18, 2019
1 parent 06945f4 commit 2977972
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions public/js/hlsPlayback.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
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");
var hls = new Hls({autoStartLoad: false});
hls.loadSource(url);
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED, function () {
hls.loadLevel = hls.levels.length - 1;
hls.startLoad();
video.play();
});
if (Hls.isSupported()) {
var hls = new Hls({autoStartLoad: false});
hls.loadSource(url);
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED, function () {
hls.loadLevel = hls.levels.length - 1;
hls.startLoad();
video.play();
});
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
video.src = url;
video.addEventListened('canplay', function() {
video.play();
});
}
}

0 comments on commit 2977972

Please sign in to comment.