Plays FLV with video.js by transmuxing FLV (either live or VoD) to MP4 and using MSE, using Bilibili's flv.js tech.
This plugin adds a source handler for flv files, as well as HTTP/Websockets for streaming live FLV streams. For more information, have a look below at the options
To install videojs-flvjs
with npm run
npm install --save securogroup/videojs-flvjs
Get a copy of videojs-flvjs and include it in your page along with video.js (this shows the live websocket implementation):
<video id=player width=600 height=300 class="video-js vjs-default-skin" controls>
<source src="ws://example.com/live/video.flv" type="video/flv">
</video>
<script src="video.js"></script>
<script src="videojs-flvjs.js"></script>
<script>
var player = videojs('#player');
</script>
flv.js is very configurable, you may pass in an options object to the source handler at player initialization. You can pass in options just like you would for other parts of video.js:
<video id=player width=600 height=300 class="video-js vjs-default-skin" controls>
<source src="ws://example.com/live/video.flv" type="video/flv">
</video>
<script src="video.js"></script>
<script src="videojs-flvjs.js"></script>
<script>
var player = videojs('video', {
autoplay: true,
html5: {
flvjsConfig: {
isLive: true,
enableStashBuffer: false
}
}
});
</script>
Thanks to the videojs-contrib-hls.js plugin for the inspiration on how to write a custom tech. This repo is modled off theirs.