Combining the examples:
We were able to write a working browser based WebRTC based sender and receiver.
These examples on their own either worked a little of not at all.
Now we have the SubC WebRTC web streamer (codename Viperfish) and receiver that worked with the modified and existing WebRTC signaling server (that was based on Signal Master).
You can find this Git repo at https://github.com/SubCImaging/SubC-Viperfish
Still in beta stages, but coming along very well. Today, 2022-Sept-30 we did a full test showing that a SubC Rayfin (using a custom app) could access the new online server (as a streamer) and then view that stream from a modified version of SubC Stream and in the MediaLooks desktop viewer at the same time. :)
The system has several parts to it. The ones this document will focus on are:
The system also has a Blazer page with allows for viewing of the stream and an Android app based on usage of a webview.
Currently we have the option to start a remote stream, but working on the option of stopping that stream once it has been started.
Currently, we have a custom NodeJS server that can host the pages, sender.html and receiver.html. Depending on usage installation can vary.
You will need:
Ensure you have NodeJS installed below following the instructions below. See Installing NodeJS section for details.
Steps:
The node_modules folder is not includes in the Git repo. Using the command npm i or npm install downloads all the needed modules.
Prebuild docker images are available at https://hub.docker.com/repository/docker/subc/viperfish. You have the options of running the docker image using:
Note: This readme file is uploaded to the docker hub as well.
| Image Name | Description |
|---|---|
| dev-1.0 | Development version of viperfish server. All debug is disabled in this version. |
| debug-1.0 | Debug version of viperfish server. |
| main-1.0 | Main version of viperfish server. All debug is disabled in this version. |
Steps:
Using "npm start" takes a reference from the package.json file and run the "scripts" > "start" command.
You can also use this system from something like Apache.
NOTE: Configuration and other related setup is not included in this documentation.
See the Folder structure section for a breakdown of how all the folders are files are available, but the sender.html and receiver.html files are what makes everything work in a non-NodeJS setup.
The browser will need to use
&between options instead of the/. Using split you can get any submitted data.
However, to enable this option you need to do a minor edit. See instructions below.
var room = undefined; to var room = location.search && location.search.split('&')[1];
ii. var vidEncoder = undefined; to var vidEncoder = location.search && location.search.split('&')[2];
iii. var vidBitrate = undefined; to var vidBitrate = location.search && location.search.split('&')[3];
iv. var signalingServer = undefined; to var signalingServer = location.search && location.search.split('&')[4];var room = undefined; to var room = location.search && location.search.split('&')[1];
ii. var signalingServer = undefined; to var signalingServer = location.search && location.search.split('&')[2];IMPORTANT NOTES:
https://{domain}:{port}/{path}/{receiver.html}?{receiver}&{stream_name}https://{domain}:{port}/{path}/{sender.html}?{sender}&{stream_name}&{video_encoder}&{video_bitrate}The web server will start listening on the provided port. From the console, it will show possible addresses you can use to access the server.
The format you need to follow is:
https://{domain}:{port}/sender/{stream_name}/{video_encoder}/{video_bitrate}
Steps
Examples:
| Name | Description | Links |
|---|---|---|
| vp8 | VP8 is an open and royalty-free video compression format released by On2 Technologies in 2008. | https://en.wikipedia.org/wiki/VP8 |
| vp9 | VP9 is the successor to VP8 and competes mainly with MPEG's High Efficiency Video Coding (HEVC/H.265). | https://en.wikipedia.org/wiki/VP9 |
| h264 | Advanced Video Coding (AVC), also referred to as H.264 or MPEG-4 Part 10, is a video compression standard based on block-oriented, motion-compensated coding. It is by far the most commonly used format for the recording, compression, and distribution of video content, used by 91% of video industry developers as of September 2019. It supports resolutions up to and including 8K UHD. | https://en.wikipedia.org/wiki/Advanced_Video_Coding |
| gpu_h264 | H.264 encoder that is done on the graphic's card. | https://developer.nvidia.com/blog/turing-h264-video-encoding-speed-and-quality/ |
| cpu_h264 | H.264 encoder that is done on the CPU. | https://en.wikipedia.org/wiki/Advanced_Video_Coding |
Bit rate (bitrate or as a variable R) is the number of bits that are conveyed or processed per unit of time.
When submitting your entry, please provide it in bits per second.
When quantifying large or small bit rates, SI prefixes (also known as metric prefixes or decimal prefixes) are used, thus:
Binary prefixes are sometimes used for bit rates. The International Standard (IEC 80000-13) specifies different abbreviations for binary and decimal (SI) prefixes (e.g. 1 KiB/s = 1024 B/s = 8192 bit/s, and 1 MiB/s = 1024 KiB/s).
| Value(bit/s) | Value(Kb/s to Mb/s) |
|---|---|
| 64000 | 64K |
| 128000 | 128K |
| 256000 | 256K |
| 512000 | 512K |
| 768000 | 768K |
| 1024000 | 1024K |
| 2048000 | 2048K |
| 4096000 | 4096K |
| 5120000 | 5120K |
The stream name but be only numbers or letters. All other characters will be removed by the server upon sending the data to the sender.html or receiver.html pages.
To view a stream, you will need to know the domain name and the name of the stream.
The format you need to follow is:
https://{domain}:{port}/receiver/{stream_name}
You may be access for access to your camera and microphone, please allow.
The stream name but be only numbers or letters. All other characters will be removed by the server upon sending the data to the sender.html or receiver.html pages.
Just because you can get access to your camera and have what appears to be a valid stream outgoing, does not mean it is working.
Checking if able to view it from a browser is helpful, but using the formatted url, https://{domain}:{port}/receiver/{stream_name}. But some it's not working try checking the below.
= undefined. If you see this issue, there is something mis-configured in the /config/defaults.json file or the server needs to be restarted from the console.Keep in mind, for a viewer, you only need to see two global(s), the room and the signaling server.
// Set room (will be assign by server)
var room = "bob";
// Set the signaling server.
var signalingServer = "https://testserver.subcservices.com/";
However, for the sender application, you need to have the below present for it to work.
// Set room (will be assign by server)
var room = "bob";
// Set video encoder.
var vidEncoder = "h264";
// Set video bitrate.
var vidBitrate = "64000";
// Set the signaling server.
var signalingServer = "https://testserver.subcservices.com/";
Below is a full technical breakdown of the sender and receiver files and how they work. These include code samples and research links for further reading.
graph TD;
ROOT-->./js;
./js-->receiver.js;
./js-->common.js;
./js-->sender.js;
./js-->simplewebrtc-with-adapter.bundle.js;
ROOT-->./css;
./css-->common.css;
ROOT-->./ssl;
./ssl-->cert.pem;
./ssl-->key.pem;
ROOT-->./sender.html;
ROOT-->./receiver.html;
ROOT-->./204.html;
ROOT-->./404.html;
ROOT-->./server_beta.js;
ROOT-->./startServer.bat;
ROOT-->./startServer.sh;
| Filename | Description | Location |
|---|---|---|
| 204.html | Error page for the NodeJS server, for when a error 204-No content issue happens. | root |
| 404.html | Error page for the NodeJS server, for when a error 404-Page cannot be displayed issue happens. | root |
| common.css | CSS file for whole system, used by the files sender.html and receiver.html. | ./css/ |
| sender.html | WebRTC based sender application. Uses the SimplyWebRTC library located in ./js/. | root |
| sender.js | Javascript file for the sender.html file. | ./js/ |
| received.html | WebRTC based receiver application. Uses the SimplyWebRTC library located in ./js/. | root |
| received.js | Javascript file for the receiver.html file. | ./js/ |
| server_beta.js | NodeJS server | root |
Content type
Image
Digest
sha256:45608ea92…
Size
377.4 MB
Last updated
almost 4 years ago
docker pull subc/viperfish:dev-720p