RTMP support for Clappr player. Supports both RTMP direct and SMIL (dynamic streaming).
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:https://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
}
}
},
});
The plugin accepts several optional configuration options, such as:
swfPath
(default //cdn.jsdelivr.net/clappr.rtmp/latest/assets/RTMP.swf) - Path to the SWF responsible for the playback.scaling
(default letterbox) - Scaling behavior.playbackType
(default live if the source contains live on its URL, vod otherwise).bufferTime
(default 0.1) - How long to buffer before start playing the media.startLevel
(default -1) - Initial quality level index.autoSwitch
(default false) - Whether video should autoSwitch qualityuseAppInstance
(default false) - Set it totrue
if your source url contains the app instance (not required if the app instance is_definst_
).proxyType
(default none) - Determines which fallback methods are tried if an initial connection attempt to Flash Media Server fails.switchRules
(default system defined) - Rules defined to autoSwitch video quality based in some conditions.
cd src
sh build_player.sh
npm install
webpack