Skip to content
On this page

flv.js

👉 https://github.com/Bilibili/flv.js

▶ Run Code
js
function playFlv(video, url, art) {
    if (flvjs.isSupported()) {
        const flv = flvjs.createPlayer({ type: 'flv', url });
        flv.attachMediaElement(video);
        flv.load();

        // optional
        art.flv = flv; 
        art.once('url', () => flv.destroy());
        art.once('destroy', () => flv.destroy());
    } else {
        art.notice.show = 'Unsupported playback format: flv';
    }
}

var art = new Artplayer({
    container: '.artplayer-app',
    url: '/assets/sample/video.flv',
    type: 'flv',
    customType: {
        flv: playFlv,
    },
});

art.on('ready', () => {
    console.info(art.flv);
});