Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

baiyfcu/Web-Rtmp

Open more actions menu
 
 

Repository files navigation

Web-Rtmp

在网页上播放RTMP视频流,通过Websocket。

基本原理

  • 服务端

    ./websockify.py 1999 <rtmp_server>:1935
  • 浏览器

    • 使用 node-rtmpapi 解析 RTMP 协议,完成握手和通信。 (yingDev的fork 增加了浏览器支持、修正了几个错误)

    • 提取其中的 H264 视频流

    • 喂给 Broadway 解码

    decoder.decode(frame);

使用

//比如 rtmp://helloworld.com/live/abc ---> app='live', streamName='abc', rtmp_server='helloworld.com'
// ./websockify.py 1999 helloworld.com:1935
var player = new WebRtmpPlayer('ws://127.0.0.1:1999', '<app>', '<streamName>', 'rtmp://<rtmp_server>/<app>');
player.canvas.style['height'] = '100%';
document.getElementById("vidCont").appendChild(player.canvas);

运行

git clone https://github.com/yingDev/Web-Rtmp.git
cd Web-Rtmp
git submodule update --init --recursive
cnpm install
# set your rtmp params in test.js first, then 
webpack -w
# setup test server
./websockify/websockify.py 1999 <rtmp_server>:1935
open index.html

局限

  • Broadway:
    The decoder ...does not support weighted prediction for P-frames and CABAC entropy encoding...

参考资料

About

Play rtmp video stream on the web page...without Flash. (Javascript)

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 68.8%
  • AppleScript 18.6%
  • HTML 6.9%
  • Shell 5.7%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.