Skip to content

Commit

Permalink
Merge pull request #15 from Prodeko/multiplatform-playback
Browse files Browse the repository at this point in the history
Multiplatform playback
  • Loading branch information
aksun1 authored Oct 26, 2024
2 parents e49bc4b + 3b84d93 commit 53795dc
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions app/frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@ const App = () => {

if (videoEl.current) {
const videoCurrent = videoEl.current;
if (

if (Hls.isSupported()) {
// For other browsers, use Hls.js
newHls = new Hls({ liveDurationInfinity: true });
newHls.attachMedia(videoCurrent);
newHls.on(Hls.Events.MEDIA_ATTACHED, () => {
newHls.loadSource(url);
});
} else if (
videoCurrent.canPlayType("application/vnd.apple.mpegurl") ===
"maybe" // This result type is ridiculous
) {
Expand All @@ -29,13 +37,6 @@ const App = () => {
videoCurrent.addEventListener("loadedmetadata", function () {
videoCurrent.play();
});
} else if (Hls.isSupported()) {
// For other browsers, use Hls.js
newHls = new Hls({ liveDurationInfinity: true });
newHls.attachMedia(videoCurrent);
newHls.on(Hls.Events.MEDIA_ATTACHED, () => {
newHls.loadSource(url);
});
} else {
console.error("HLS not supported on this browser");
}
Expand Down

0 comments on commit 53795dc

Please sign in to comment.