video-dev / clappr-rtmp-plugin

📺 RTMP support for Clappr player.
http://clappr.io
Apache License 2.0
105 stars 46 forks source link
actionscript clappr-player javascript player rtmp rtmp-support video

clappr-rtmp-plugin

RTMP support for Clappr player. Supports both RTMP direct and SMIL (dynamic streaming).

How to use

Import rtmp.min.js

<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/video-dev/clappr-rtmp-plugin@latest/dist/rtmp.min.js">
</script>

and create Clappr Player adding the external plugin:

var player = new Clappr.Player({
    source: "rtmp://source_here",
    parentId: "#player-wrapper",
    plugins: {'playback': [RTMP]},
    rtmpConfig: {
        swfPath: 'dist/assets/RTMP.swf',
        scaling:'stretch',
        playbackType: 'live',
        bufferTime: 1,
        startLevel: 0,
        switchRules: {
            "SufficientBandwidthRule": {
                "bandwidthSafetyMultiple": 1.15,
                "minDroppedFps": 2
            },
            "InsufficientBufferRule": {
                "minBufferLength": 2
            },
            "DroppedFramesRule": {
                "downSwitchByOne": 10,
                "downSwitchByTwo": 20,
                "downSwitchToZero": 24
            },
            "InsufficientBandwidthRule": {
                "bitrateMultiplier": 1.15
            }
        }
    },
});

Configuration

The plugin accepts several optional configuration options, such as:

Building

Requirements

  1. AirSDK
  2. Webpack

Compile SWF

cd src
sh build_player.sh

Download JS dependencies

npm install

Build the final dist

webpack