Convert Figma logo to code with AI

bilibili logoflv.js

HTML5 FLV Player

22,890
3,391
22,890
446

Top Related Projects

37,823

Video.js - open source HTML5 video player

The HTML5 video player for the web

JW Player is the world's most popular embeddable media player.

7,076

:clapper: An extensible media player for the web.

5,087

A reference client implementation for the playback of MPEG DASH via Javascript and compliant browsers.

JavaScript player library / DASH & HLS client / MSE-EME player

Quick Overview

Flv.js is an HTML5 Flash Video (FLV) player written in pure JavaScript without Flash. It works by transmuxing FLV file stream into ISO BMFF (MP4) segments, followed by feeding mp4 segments into an HTML5 <video> element through Media Source Extensions API.

Pros

  • Pure JavaScript implementation, no Flash required
  • Supports playback of FLV files in modern browsers without plugins
  • Lightweight and efficient
  • Compatible with HTML5 video features

Cons

  • Limited to browsers that support Media Source Extensions
  • May have higher CPU usage compared to native video playback
  • Lacks support for some advanced FLV features
  • Not actively maintained (last commit was in 2020)

Code Examples

  1. Basic usage:
var player = flvjs.createPlayer({
    type: 'flv',
    url: 'http://example.com/flv/video.flv'
});
player.attachMediaElement(videoElement);
player.load();
player.play();
  1. Configuring playback options:
var player = flvjs.createPlayer({
    type: 'flv',
    url: 'http://example.com/flv/video.flv',
    isLive: true,
    cors: true,
    withCredentials: false,
});
  1. Listening to events:
player.on(flvjs.Events.ERROR, function(errorType, errorDetail) {
    console.log('Error: ' + errorType + ' - ' + errorDetail);
});

Getting Started

  1. Include flv.js in your HTML file:
<script src="https://cdn.jsdelivr.net/npm/flv.js/dist/flv.min.js"></script>
  1. Create a video element in your HTML:
<video id="videoElement"></video>
  1. Initialize and use the player in your JavaScript:
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();
}

Competitor Comparisons

37,823

Video.js - open source HTML5 video player

Pros of video.js

  • Broader format support: Handles various video formats beyond FLV
  • Extensive plugin ecosystem: Large community-contributed library of plugins
  • More comprehensive documentation and examples

Cons of video.js

  • Larger file size: Heavier library due to broader feature set
  • Steeper learning curve: More complex API for advanced customizations

Code Comparison

video.js:

videojs('my-video', {
  controls: true,
  sources: [{ src: 'video.mp4', type: 'video/mp4' }]
});

flv.js:

flvjs.createPlayer({
  type: 'flv',
  url: 'video.flv'
}).attachMediaElement(videoElement);

Key Differences

  • video.js offers a more abstracted API, while flv.js provides lower-level control
  • flv.js is specifically designed for FLV playback, making it more lightweight for this use case
  • video.js has built-in UI controls, whereas flv.js focuses on core playback functionality

Use Cases

  • Choose video.js for projects requiring support for multiple video formats and extensive customization options
  • Opt for flv.js when working specifically with FLV files and prioritizing a lightweight solution

Community and Maintenance

  • video.js has a larger community and more frequent updates
  • flv.js, while less actively maintained, is still a solid choice for FLV-specific needs

The HTML5 video player for the web

Pros of Flowplayer

  • Supports a wider range of video formats, including HLS and DASH
  • More comprehensive feature set, including advertising integration and analytics
  • Actively maintained with regular updates and improvements

Cons of Flowplayer

  • Larger file size and potentially higher resource usage
  • Commercial product with licensing fees for advanced features
  • Steeper learning curve due to more complex API and configuration options

Code Comparison

flv.js:

var flvPlayer = flvjs.createPlayer({
    type: 'flv',
    url: 'http://example.com/flv/video.flv'
});
flvPlayer.attachMediaElement(videoElement);
flvPlayer.load();

Flowplayer:

flowplayer("#player", {
    clip: {
        sources: [
            { type: "application/x-mpegurl", src: "http://example.com/playlist.m3u8" }
        ]
    }
});

Summary

Flowplayer offers a more comprehensive solution with support for multiple formats and advanced features, making it suitable for complex video streaming needs. However, it comes with higher costs and complexity. flv.js, on the other hand, is a lightweight, open-source solution specifically designed for FLV playback, offering simplicity and ease of use for projects that primarily deal with FLV files.

JW Player is the world's most popular embeddable media player.

Pros of jwplayer

  • More comprehensive media player solution with support for various formats
  • Extensive customization options and API for advanced functionality
  • Robust documentation and community support

Cons of jwplayer

  • Proprietary software with licensing costs for commercial use
  • Heavier footprint compared to flv.js, which focuses solely on FLV playback
  • Steeper learning curve due to its extensive feature set

Code Comparison

flv.js:

var flvPlayer = flvjs.createPlayer({
    type: 'flv',
    url: 'http://example.com/flv/video.flv'
});
flvPlayer.attachMediaElement(videoElement);
flvPlayer.load();

jwplayer:

jwplayer("myElement").setup({
    file: "http://example.com/video.mp4",
    width: "100%",
    aspectratio: "16:9"
});

Summary

flv.js is a lightweight, open-source solution specifically designed for FLV playback in HTML5 video. It's ideal for projects that primarily deal with FLV files and require a simple, focused implementation.

jwplayer, on the other hand, is a full-featured media player that supports various formats and offers extensive customization options. It's better suited for complex projects that require advanced features and cross-platform compatibility but comes with licensing costs for commercial use.

The choice between the two depends on the specific requirements of your project, budget constraints, and the level of functionality needed.

7,076

:clapper: An extensible media player for the web.

Pros of Clappr

  • Supports multiple media formats (HLS, DASH, MP4, etc.) out of the box
  • Modular architecture allows for easy plugin development and customization
  • Extensive documentation and active community support

Cons of Clappr

  • Larger file size and potentially higher resource usage
  • May have a steeper learning curve for basic implementations
  • Less specialized for FLV playback compared to flv.js

Code Comparison

Clappr initialization:

var player = new Clappr.Player({
  source: "http://your.video/here.mp4",
  parentId: "#player"
});

flv.js initialization:

var player = flvjs.createPlayer({
  type: 'flv',
  url: 'http://example.com/flv/video.flv'
});
player.attachMediaElement(videoElement);
player.load();

Key Differences

  • Clappr provides a more comprehensive media player solution with built-in UI and plugins
  • flv.js is specifically designed for FLV playback and offers lower-level control
  • Clappr's API is more abstracted, while flv.js provides more direct access to the underlying player

Use Cases

  • Choose Clappr for a versatile player supporting multiple formats with easy customization
  • Opt for flv.js when focusing specifically on FLV playback or requiring fine-grained control over the player
5,087

A reference client implementation for the playback of MPEG DASH via Javascript and compliant browsers.

Pros of dash.js

  • Supports adaptive bitrate streaming using MPEG-DASH
  • Wider industry adoption and standardization
  • More comprehensive feature set for streaming (e.g., live streaming, DRM support)

Cons of dash.js

  • Larger file size and potentially higher complexity
  • May require more setup and configuration for basic use cases

Code Comparison

dash.js:

var player = dashjs.MediaPlayer().create();
player.initialize(document.querySelector("#videoPlayer"), "video.mpd", true);

flv.js:

var player = flvjs.createPlayer({
    type: 'flv',
    url: 'video.flv'
});
player.attachMediaElement(document.getElementById('videoElement'));
player.load();

Key Differences

  • dash.js focuses on MPEG-DASH streaming, while flv.js is specifically for FLV playback
  • dash.js offers more advanced features for professional streaming scenarios
  • flv.js is generally simpler to set up and use for basic FLV playback needs

Use Cases

  • dash.js: Ideal for large-scale streaming services, live events, and scenarios requiring adaptive bitrate
  • flv.js: Better suited for platforms primarily dealing with FLV content or requiring lightweight playback solutions

Community and Support

  • dash.js has a larger community and more frequent updates due to its wider adoption
  • flv.js, while less actively maintained, still has a dedicated user base, especially in regions where FLV is common

JavaScript player library / DASH & HLS client / MSE-EME player

Pros of shaka-player

  • Supports a wider range of streaming formats (DASH, HLS, MSS)
  • More comprehensive feature set, including offline playback and DRM support
  • Active development with frequent updates and a larger community

Cons of shaka-player

  • Larger file size and potentially higher resource usage
  • Steeper learning curve due to more complex API and configuration options

Code Comparison

shaka-player:

const player = new shaka.Player(videoElement);
player.load('https://example.com/video.mpd').then(() => {
  console.log('The video has been loaded');
});

flv.js:

const player = flvjs.createPlayer({
  type: 'flv',
  url: 'https://example.com/video.flv'
});
player.attachMediaElement(videoElement);
player.load();

Summary

shaka-player offers a more comprehensive solution for modern streaming needs, supporting multiple formats and advanced features like DRM and offline playback. However, this comes at the cost of increased complexity and resource usage. flv.js, on the other hand, is a lightweight and focused solution specifically for FLV playback, making it simpler to implement but with more limited functionality. The choice between the two depends on the specific requirements of your project, such as supported formats, desired features, and performance considerations.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

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

  • FLV container with H.264 + AAC / MP3 codec playback
  • Multipart segmented video playback
  • HTTP FLV low latency live stream playback
  • FLV over WebSocket live stream playback
  • Compatible with Chrome, FireFox, Safari 10, IE11 and Edge
  • Extremely low overhead, and hardware accelerated by your browser!

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

  • MP3 audio codec is currently not working on IE11 / Edge
  • HTTP FLV live stream is not currently working on all browsers, see livestream.md

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.

NPM DownloadsLast 30 Days