import './bootstrap.js'; import Hls from "./vendor/hls.js/hls.js.index.js"; /* * Welcome to your app's main JavaScript file! * * This file will be included onto the page via the importmap() Twig function, * which should already be in your base.html.twig. */ import './styles/app.css'; console.log('This log comes from assets/app.js - welcome to AssetMapper! 🎉'); let alert = document.querySelector('.alert'); var observer = new MutationObserver(function(mutations) { if (document.contains(alert)) { observer.disconnect(); } }); observer.observe(document, {attributes: false, childList: true, characterData: false, subtree:true}); document.addEventListener("DOMContentLoaded", () => { const videoUrl = "http://127.0.0.1:11470/hlsv2/2b76fe2ec12c83d264076fb859923c5d/master.m3u8?mediaURL=https%3A%2F%2Ftorrentio.strem.fun%2Frealdebrid%2FQYYBR7OSQ4VEFKWASDEZ2B4VO67KHUJY6IWOT7HHA7ATXO7QCYDQ%2F6bf1938db882f6fcbb0dafa6e7326230e7f4eae0%2Fnull%2F3%2FSurvivor.S48E01.1080p.HEVC.x265-MeGusta.mkv%26videoCodecs%3Dh264%26videoCodecs%3Dh265%26videoCodecs%3Dhevc%26videoCodecs%3Dvp9%26audioCodecs%3Daac%26audioCodecs%3Dmp3%26audioCodecs%3Dopus%26maxAudioChannels%3D2"; var video = document.getElementById('video'); if (Hls.isSupported()) { var hls = new Hls({ debug: true, }); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.MEDIA_ATTACHED, function () { video.muted = true; video.play(); }); } // hls.js is not supported on platforms that do not have Media Source Extensions (MSE) enabled. // When the browser has built-in HLS support (check using `canPlayType`), we can provide an HLS manifest (i.e. .m3u8 URL) directly to the video element through the `src` property. // This is using the built-in support of the plain video element, without using hls.js. else if (video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; video.addEventListener('canplay', function () { video.play(); }); } })