aeinstein / webrtmp

A javascript RTMP client for browsers
Apache License 2.0
28 stars 1 forks source link
aac h264 h264-streamer hls html5 rtmp rtmp-client rtmp-player streaming websocket-server

WebRTMP

A HTML5 Flash Video (RTMP) Player written in pure JavaScript without Flash. LONG LIVE RTMP ;-)

For those who really miss RTMP in Browser, cause HLS sucks. This will be a part of avideo.

heavily inspired bei bilibi`s FlvPlayer

Introduction

This project consists of 2 parts.

Demo

https://bunkertv.org/webrtmp/index.html

Features

Getting Started

ClientSide:

<script src="https://github.com/aeinstein/webrtmp/raw/master/dist/webrtmp.js"></script>
<video id="videoElement"></video>
<script>
    const videoElement = document.getElementById('videoElement');

    const rtmp_player = webrtmpjs.createWebRTMP();

    rtmp_player.attachMediaElement(videoElement);

    rtmp_player.open(document.location.host, 9001).then(()=>{   // Host, Port of WebRTMP Proxy
        rtmp_player.connect("demo").then(()=>{                  // Application name  
            rtmp_player.play("your streanname").then(()=>{      // Stream name
                console.log("playing");
            })
        })
    })
</script>

ServerSide:

Prerequisites:

apt install websockify

Launch WSS RTMP-Wrapper (Don't forget to get certificates)

websockify -D --cert fullchain.pem --key privkey.pem --ssl-only 9001 127.0.0.1:1935

TODO

a lot of error and exception handling

Design

serverSide

arch