flv.js README

The project's README from github.com/bilibili/flv.js. As one markdown file: README.md.

flv.js npm

An HTML5 Flash Video (FLV) Player written in pure JavaScript without Flash. LONG LIVE FLV!

This project relies on Media Source Extensions to work.

For FLV live stream playback, please consider mpegts.js which is under active development.

This project will become rarely maintained.

Overview

flv.js works by transmuxing FLV file stream into ISO BMFF (Fragmented MP4) segments, followed by feeding mp4 segments into an HTML5 <video> element through Media Source Extensions API.

Demo

http://bilibili.github.io/flv.js/demo/

Features

Installation

npm install --save flv.js

Build

npm ci                 # install dependencies / dev-dependences
npm run build:debug    # debug version flv.js will be emitted to /dist
npm run build          # minimized release version flv.min.js will be emitted to /dist

cnpm mirror is recommended if you are in Mainland China.

CORS

If you use standalone video server for FLV stream, Access-Control-Allow-Origin header must be configured correctly on video server for cross-origin resource fetching.

See cors.md for more details.

Getting Started

<script src="flv.min.js"></script>
<video id="videoElement"></video>
<script>
    if (flvjs.isSupported()) {
        var videoElement = document.getElementById('videoElement');
        var flvPlayer = flvjs.createPlayer({
            type: 'flv',
            url: 'http://example.com/flv/video.flv'
        });
        flvPlayer.attachMediaElement(videoElement);
        flvPlayer.load();
        flvPlayer.play();
    }
</script>

Limitations

Multipart playback

You only have to provide a playlist for MediaDataSource. See multipart.md

Livestream playback

See livestream.md

API and Configuration

See api.md

Debug

npm ci         # install dependencies / dev-dependences
npm run dev    # watch file changes and build debug version on the fly

Design

See design.md

License

Copyright (C) 2016 Bilibili. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

flv.js (bilibili/flv.js)

media-player
Searching Database…

23.2K ·GitHub
What is this?flv.js is an HTML5 FLV (Flash Video) player written in pure JavaScript, with no Flash plugin required.
Is it a browser library or a standalone app?It is a JavaScript library you embed on a web page: it transmuxes FLV streams into Fragmented MP4 segments and feeds them into an HTML5 video element via Media Source Extensions.
How do I add flv.js to my project?Build it with the provided npm/webpack scripts (e.g. 'npm run build' for production), then load the resulting script and attach it to a video element as described in the Getting Started docs.
Does flv.js need Flash or any plugin?No, it relies only on the browser's native Media Source Extensions API, plus internal JS dependencies like es6-promise and webworkify-webpack.
Is this project still actively maintained?No, the README states flv.js will become rarely maintained, and for live stream playback it recommends switching to mpegts.js instead.
Which browsers does it work in?It's compatible with Chrome, Firefox, Safari 10, IE11 and Edge, since it just needs browser-native MSE support.
What video/audio codecs can flv.js play?It plays FLV containers with H.264 video plus AAC or MP3 audio, and supports multipart segmented video playback.
Can flv.js play live streams, not just files?Yes, it supports HTTP-FLV low-latency live streaming and FLV-over-WebSocket live streaming, though HTTP FLV live isn't working in all browsers.
Are there any known codec/browser quirks?MP3 audio currently doesn't work on IE11/Edge, and HTTP FLV live streaming isn't reliable across all browsers.
Should I use flv.js or mpegts.js today?For live stream playback specifically, the author recommends mpegts.js since it's actively developed while flv.js is becoming rarely maintained.
Creator
bilibili
Size
1.6 MB
Stars
23.2K
Age
10y
Commits · 90 Days