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)

Searching Database…

23.2K ·GitHub
这是什么?flv.js 是一个用纯 JavaScript 编写的 HTML5 FLV(Flash Video)播放器,不需要 Flash 插件。
这是浏览器库还是独立应用?它是一个嵌入网页使用的 JavaScript 库:通过 Media Source Extensions 将 FLV 流转封装为分段 MP4(Fragmented MP4)片段,并送入 HTML5 video 元素播放。
如何将 flv.js 添加到我的项目中?使用项目提供的 npm/webpack 脚本进行构建(生产环境可运行 'npm run build'),然后加载生成的脚本,并按照入门文档中的说明将其绑定到 video 元素上。
flv.js 需要 Flash 或任何插件吗?不需要,它只依赖浏览器原生的 Media Source Extensions API,以及 es6-promise 和 webworkify-webpack 等内部 JS 依赖。
这个项目还在积极维护吗?不再积极维护。README 中说明 flv.js 将进入维护较少的状态;对于直播流播放,作者建议改用 mpegts.js。
它能在哪些浏览器中运行?它兼容 Chrome、Firefox、Safari 10、IE11 和 Edge,因为它只需要浏览器原生支持 MSE 即可。
flv.js 能播放哪些视频/音频编码?它可以播放封装为 FLV 格式的 H.264 视频,搭配 AAC 或 MP3 音频,并支持多段分块的视频播放。
flv.js 能播放直播流吗,而不仅仅是文件?可以,它支持 HTTP-FLV 低延迟直播和基于 WebSocket 的 FLV 直播,不过 HTTP FLV 直播并非在所有浏览器中都能正常工作。
有哪些已知的编码或浏览器兼容问题?MP3 音频目前在 IE11/Edge 上无法播放,HTTP FLV 直播在所有浏览器中也并不稳定。
现在应该用 flv.js 还是 mpegts.js?如果是专门用于直播流播放,作者推荐 mpegts.js,因为它仍在积极开发,而 flv.js 正逐渐进入维护较少的状态。
Creator
bilibili
Size
1.6 MB
Stars
23.2K
Age
10y
Commits · 90 Days