import{_ as a,c as l,o as p,x as s,a as n,U as o}from"./chunks/framework.75837252.js";const m=JSON.parse('{"title":"hls.js","description":"","frontmatter":{},"headers":[],"relativePath":"library/hls.md","lastUpdated":1673441101000}'),e={name:"library/hls.md"},r=s("h1",{id:"hls-js",tabindex:"-1"},[n("hls.js "),s("a",{class:"header-anchor",href:"#hls-js","aria-label":'Permalink to "hls.js"'},"​")],-1),t=s("p",null,[n("👉 "),s("a",{href:"https://github.com/video-dev/hls.js",target:"_blank",rel:"noreferrer"},"https://github.com/video-dev/hls.js")],-1),c=s("div",{className:"run-code","data-libs":"https://cdnjs.cloudflare.com/ajax/libs/hls.js/8.0.0-beta.3/hls.min.js"}," ▶ Run Code ",-1),F=o(`
js
function playM3u8(video, url, art) {
    if (Hls.isSupported()) {
        const hls = new Hls();
        hls.loadSource(url);
        hls.attachMedia(video);

        // optional
        art.hls = hls;
        art.once('url', () => hls.destroy());
        art.once('destroy', () => hls.destroy());
    } else if (video.canPlayType('application/vnd.apple.mpegurl')) {
        video.src = url;
    } else {
        art.notice.show = 'Unsupported playback format: m3u8';
    }
}

var art = new Artplayer({
    container: '.artplayer-app',
    url: 'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8',
    type: 'm3u8',
    customType: {
        m3u8: playM3u8,
    },
});

art.on('ready', () => {
    console.info(art.hls);
});
`,1),y=[r,t,c,F];function D(i,A,C,b,h,u){return p(),l("div",null,y)}const _=a(e,[["render",D]]);export{m as __pageData,_ as default};