All Projects → zhw2590582 → Flvplayer

zhw2590582 / Flvplayer

Licence: mit
🍭 FlvPlayer.js is a JavaScript player for decode flv to the canvas

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Flvplayer

Wxinlineplayer
🤟Super fast H.264/H.265 FLV player
Stars: ✭ 873 (+315.71%)
Mutual labels:  webgl, player, h264, flv, canvas
Nodeplayer.js
Pure JavaScrip HTML5 live stream player
Stars: ✭ 157 (-25.24%)
Mutual labels:  player, aac, h264, flv
Analysisavp
音视频学习,相关文件格式/协议分析。h264 nalu aac adts flv
Stars: ✭ 38 (-81.9%)
Mutual labels:  aac, h264, flv
Layaair discard
This is old LayaAir veriosn writetten by ActionScript 3.0 ,now LayaAir is using TypeScript as the Engine Script,Please use https://github.com/layabox/LayaAir instead.
Stars: ✭ 1,858 (+784.76%)
Mutual labels:  webgl, canvas
Proton
Javascript particle animation library
Stars: ✭ 1,958 (+832.38%)
Mutual labels:  webgl, canvas
Zen 3d
JavaScript 3D library.
Stars: ✭ 155 (-26.19%)
Mutual labels:  webgl, canvas
Nginx Http Flv Module
Media streaming server based on nginx-rtmp-module. In addtion to the features nginx-rtmp-module provides, HTTP-FLV, GOP cache and VHOST (one IP for multi domain names) are supported now.
Stars: ✭ 2,063 (+882.38%)
Mutual labels:  aac, h264
Demos
One repo to rule them all.
Stars: ✭ 204 (-2.86%)
Mutual labels:  webgl, canvas
Mesh.js
A graphics system born for visualization 😘.
Stars: ✭ 156 (-25.71%)
Mutual labels:  webgl, canvas
Haishinkit.swift
Camera and Microphone streaming library via RTMP, HLS for iOS, macOS, tvOS.
Stars: ✭ 2,237 (+965.24%)
Mutual labels:  aac, h264
Magnum Examples
Examples for the Magnum C++11/C++14 graphics engine
Stars: ✭ 180 (-14.29%)
Mutual labels:  webgl, webassembly
Pychat
webchat via WebSockets/WebRTC that allows messaging/video call/screen sharing
Stars: ✭ 152 (-27.62%)
Mutual labels:  webassembly, canvas
Wechart
Create all the [ch]arts by cax or three.js - Cax 和 three.js 创造一切图[表]
Stars: ✭ 152 (-27.62%)
Mutual labels:  webgl, canvas
Tilemap
Rectangular tilemap implementation for PixiJS
Stars: ✭ 177 (-15.71%)
Mutual labels:  webgl, canvas
Sandspiel
Creative cellular automata browser game
Stars: ✭ 2,476 (+1079.05%)
Mutual labels:  webgl, webassembly
Playease
This is not only an HTML5 FLV Player, but also supports HTTP/WS-fMP4, MPEG-DASH, HLS and Original HTML5 Media Resources, with an independent UI framework.
Stars: ✭ 146 (-30.48%)
Mutual labels:  player, flv
Patches
Patches is a visual programming editor for building WebVR and WebGL experiences.
Stars: ✭ 164 (-21.9%)
Mutual labels:  webgl, player
Canvas2dtowebgl
Ports (almost) all Canvas2D functions to the GPU so it can be mixed with a WebGL canvas.
Stars: ✭ 206 (-1.9%)
Mutual labels:  webgl, canvas
R3f Next Starter
Repo is moving to https://github.com/pmndrs/react-three-next
Stars: ✭ 137 (-34.76%)
Mutual labels:  webgl, canvas
Alien.js
Future web pattern
Stars: ✭ 141 (-32.86%)
Mutual labels:  webgl, canvas

FlvPlayer

Build Status version license size npm Downloads PRs Welcome dependencies Status

FlvPlayer.js is a JavaScript player for decode flv to the canvas

Homepage

https://flvplayer.js.org

Mobile Demo

Mobile Demo

Install player

Install with npm

$ npm install flvplayer

Or install with yarn

$ yarn add flvplayer
import FlvPlayer from 'flvplayer';

Or umd builds are also available

<script src="path/to/flvplayer.js"></script>

Will expose the global variable to window.FlvPlayer.

Install control(optional)

You should load the control before load the player.

import 'path/to/flvplayer-control.js';

Or umd builds are also available

<script src="path/to/flvplayer-control.js"></script>

Will expose the global variable to window.FlvplayerControl.

Usage

<div class="flvplayer-app"></div>
if (FlvPlayer.isSupported()) {
    var flv = new FlvPlayer({
        // Accept http url, websocket url, and file type
        url: '',

        // Accept dom element, dom selector
        container: '',

        // Video poster url
        poster: '',

        // Whether to print debug information
        debug: false,

        // Whether live mode
        live: false,

        // Whether the video loops, in non-live mode
        loop: false,

        // Whether to use hotkeys, if the control exists
        hotkey: true,

        // Whether to turn off the volume
        muted: false,

        // On the mobile side, try to activate the audio after the user touches the screen.
        touchResume: true,

        // Video chunk size, the default is 1M
        videoChunk: 1024 * 1024,

        // Audio chunk size, the default is 16kb
        audioChunk: 16 * 1024,

        // Whether to play automatically
        autoPlay: false,

        // Whether it contains an audio stream
        hasAudio: true,

        // Whether to cache the video frame to play
        cache: true,

        // Maximum time difference between audio and video, unit is ms
        // used to automatically adjust audio and video synchronization
        maxTimeDiff: 200,

        // Whether to display the control, if the control exists
        control: true,

        // Indicates whether to do http fetching with cookies
        withCredentials: true,

        // Indicates total file size of media file, in bytes
        filesize: Infinity,

        // Indicates whether to enable CORS for http fetching
        cors: true,

        // Volume from 0 to 1, the default is 0.7
        volume: 0.7,

        // Initialize the frame rate, which will be covered by the actual frame rate of the file
        frameRate: 30,

        // Initialize the width, which will be covered by the actual width of the file
        width: 400,

        // Initialize the height, which will be covered by the actual height of the file
        height: 300,

        // Initialize http headers
        headers: {},

        // The path of the video decoder, currently optional flvplayer-decoder-baseline.js and flvplayer-decoder-multiple.js
        decoder: 'flvplayer-decoder-baseline.js',
    });
} else {
    console.warn('Your browser does not support Flvplayer.js');
}

Question

Q: What is the difference between flvplayer-decoder-baseline.js and flvplayer-decoder-multiple.js.

  • flvplayer-decoder-baseline.js only supports flv in this Baseline profile, only 200k size.
  • flvplayer-decoder-multiple.js supports flv in this BaselineMainExtended and High profile, but have 2M size.

API

Instance methods and properties

Play video:

flv.play();

Pause video:

flv.pause();

Switch whether to play:

flv.toggle();

Destroy instance:

flv.destroy();

Whether it is playing:

flv.playing;

Is the stream being pulled:

flv.streaming;

Get the current time of the video:

flv.currentTime;

Get the duration of the video:

flv.duration;

Get the loaded of the video:

flv.loaded;

Whether it is focus:

flv.isFocus;

Set whether to turn off the volume:

flv.muted;

Set the volume:

flv.volume;

Get canvas elements:

flv.$canvas;

Instance event

Name Description
destroy When destroying an instance
streamStart Start pulling the stream
streaming When pulling stream
streamEnd At the end of the pull stream
demuxDone Demux completed
resize When container resize
play When video play
timeupdate When video timeupdate
waiting When video waiting
ended When video ended
loop When video loop
pause When video pause
seeked When video seeked
ready When video ready
streamRate Stream Rate
demuxRate Demux Rate
decoderRate Decoder Rate
drawRate Draw Rate

Example:

flv.on('play', function () {
    console.log('Video is play!');
});

Class methods and properties

Get all instances:

FlvPlayer.instances;

Check if support:

FlvPlayer.isSupported;

Get the version:

FlvPlayer.version;

Get the env:

FlvPlayer.env;

Contribution

Installation dependency

$ npm install

Run the developer mode

$ npm run dev

Open web server

$ npm start

Donations

We accept donations through these channels:

pay

QQ Group

QQ Group

License

MIT © Harvey Zack

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].