streaming html5

2025-12-11 0 449

requirements
publishing
subscribing

Red5 Pro HTML Streaming Testbed

This repository contains a simple project with a number of examples that can be used for testing and reference for the Red5 Pro WebRTC SDK.

Requirements

You will need a functional, running Red5 Pro server web- (or locally-) accessible for the client browser (mobile & desktop) to connect to.

For more information visit https://www.**r*ed5.net/.

Browser Compability

The Red5 Pro WebRTC SDK aims to utilize WebRTC for its streaming solution (both publishing and subscribing), but also provides HLS support for browsers that support it natively (e.g., Mobile and Desktop Safari).

More information about browser compability can be viewed at the WebRTC Peer Connnection information on caniuse.com.

Publisher

The term Publisher in the context of Red5 Pro refers to a client that produces a broadcast stream. There are two types of instances from the SDK that can be utilized to start a Publisher:

  1. WHIPClient – The WHIPClient relies on the WebRTC-HTTP ingestion protocl to establish a connection through series of HTTP/S requests.
  2. RTCPublisher – The RTCPublisher relies on a WebSocket connection to establish a broadcast session.

The WHEPClient connection sequence is very fast – ~1 second – whereas the RTCPublisher, due to its reliance on a WebSocket can take roughly 3 – 5 seconds for a connection to stream.

Subscriber

The term Subscriber in the context of Red5 Pro refers to a client that consumes and plays back an already live broadcast stream. There are three types of instances from the SDK that can be utilized to start a Subscriber:

  1. WHEPClient – The WHEPClient relies on the WebRTC-HTTP egress protocol to establish a connection through series of HTTP/S requests.
  2. RTCSubscriber – The RTCSubscriber relies on a WebSocket connection to establish a broadcast session.
  3. HLSSubscriber – The HLSSubscriber relies on the native ability to playback HLS streams (e.g., Mobile and Desktop Safari).

The WHEPClient connection sequence is very fast – ~1 second – whereas the RTCPublisher, due to its reliance on a WebSocket can take roughly 3 – 5 seconds for a connection to stream

The HLSSubscriber does not go through a connection sequence and streams the HLS directly from the server, however it does have an up to 6 second latency due to the length of its live segments.

NOTE: The WHIPClient and WHEPClient were introduced in the 11.0.0 release of the Red5 Pro WebRTC SDK.

Setup

You will need to modify the Host field from the Settings page to point to your server instance\’s IP address. If you do not, the examples will not function when you build. If you are running the server locally, then your machine and mobile device need to be on the same WiFi network.

Note on TLS and CORS

It is important to note that some of these examples – specifically those that involve publishing using WebRTC – require being run on TLS and, thusly, served over HTTPS. If running the examples on localhost you should not see an issues, but if your server is deployed remotely you will need to be sure that these examples are served over HTTPS and the proper Cross Origin Resource Sharing (CORS) settings are defined for the server.

  • Read More about Red5 Pro and SSL.
  • More information on CORS.

Instructions

To define the server instance\’s IP address, open the testbed webapp in a browser and navigate to the Settings page if not presented upon launch. To access the Settings back, select the Home item from the examples list located at the top.

To define the Host with the server instance\’s IP, click the Host field f the form and enter in the local or remote IP address – e.g., 10.0.0.5, 76.199.199.199.

Hint: You can also open the landing page of your server instance at port 5080 (i.e., http://*l*ocal*host:5080 if launched locally) and the page will display its IP in the upper-right corner.

WHIP/WHEP Settings Option

You can select to prefer WHIP/WHEP from the Settings page. By selecting this option, all tests will utilize the WHEPClient and WHIPClient for publishing and subscribing, respectively.

If you decide to de-select the WHIP/WHEP option, all tests will revert to using the RTCPublisher and RTCSubscriber for publishing and subscibing, respectively. These instances require WebSocket support in the browser during their negotiation stage. Once the connection is made, the messaging transport system is switching to RTCDataChannel and the WebSocket is closed.

Examples

Publishing

Publisher
Basic publisher example using WebRTC, with option to utilize either WebRTC-HTTP ingestion(a.k.a., WHIP) or WebSockets to establish a broadcast connection.
1080p
A high quality publisher.
Append
Demonstrates recording a stream to the server with append option.
Authentication
Demonstrates authentication with the Simple-Auth-Plugin for publishing.
Camera Source
Demonstrates selecting the desired camera to publish with.
Camera Swap
Demonstrates a request for a MediaStream with a defined video source for the constraint based on the Rear and Front facing cameras of a mobile device and a browser that supports facingMode media contraints.
Custom Settings
Allows you to customize the media broadcast settings for a WebRTC Publisher.
Custom Audio Settings
Allows you to customize the audio settings for a WebRTC Publisher.
MediaStream Swap
Demonstrates using replaceTrack to swap in a different Camera source dynamically for WebRTC-based Publishers.
Image Capture
Demonstrates capturing an image of a live video being published.
Mute
Muting and unmuting audio for a live video being published.
Record
Demonstrates recording a stream to the server for VOD (Video-On-Demand) playback.
Append
Demonstrates record-append function a stream to the server for VOD (Video-On-Demand) playback.
Remote Call
Demonstrates sending a remote message to all subscribed clients.
Round Trip Authentication
An example of utilizing round-trip authentication with Red5 Pro.
Screen Share
An example of utilizing the screen sharing capabilities of Chrome and Firefox.
For use with Subscribe Screen Share example.
Social Media Stream Push
An example of rebroadcasting a live stream to a social media platform.
VP8
An example for requesting VP8 video codec on publish

Publishing – Stream Manager Examples

Stream Manager
Demonstrates utilizing the Red5 Pro Stream Manager API to publish to an autoscaling cluster\’s origin.
Stream Manager Proxy
Demonstrates utilizing the Red5 Pro Stream Manager as an SSL WebSocket Proxy to publish WebRTC to an autoscaling cluster\’s origin.
Stream Manager Proxy Camera Select
Demonstrates utilizing the Red5 Pro Stream Manager as an SSL WebSocket Proxy to publish WebRTC to an autoscaling cluster\’s origin with camera select.
Stream Manager Proxy Settings
Demonstrates utilizing the Red5 Pro Stream Manager as an SSL WebSocket Proxy to publish WebRTC with custom video settings to an autoscaling cluster\’s origin.
Stream Manager Proxy Settings with Audio
Demonstrates utilizing the Red5 Pro Stream Manager as an SSL WebSocket Proxy to publish WebRTC with custom audio settings to an autoscaling cluster\’s origin.
Stream Manager Proxy Round Trip Authenticaion
An example of utilizing round-trip authentication with Red5 Pro over Stream Manager Proxy.
Stream Manager Proxy Screen Share
An example of utilizing the screen sharing capabilities of Chrome and Firefox. For use with Stream Manager Proxy Subscribe Screen Share example.
Stream Manager Proxy Social Media Stream Push
An example of rebroadcasting a live stream to a social media platform.
Stream Manager Transcode Provision Form
Provides an easy form to POST a new Provision to the Stream Manager for ABR broadcasts. Once the provision is POSTed, use your favorite Media Encoder to broadcast the variants.
Stream Manager Proxy Transcoder
Provides an easy form to POST a new Provision to the Stream Manager for ABR broadcasts and to start a single variant broadcast using the Transcoder.
Stream Manager Proxy Transcoder with Authentication
Provides an easy form to POST a new Provision to the Stream Manager for ABR broadcasts and to start a single variant broadcast using the Transcoder, including authentication.
Stream Manager Proxy Validation
An example of utilizing validation parameters with Red5 Pro over Stream Manager Proxy.

Multi

Two-Way
Demonstrates simultaneously publishing while subscribing – allowing a conversation. Includes stream detection and auto-connection.
Two-Way Stream Manager Proxy
The Two-Way example through a Stream Manager – including use of a proxy. Includes stream detection and auto-connection.
Conference
Demonstrates multi-party communication using Red5 Pro. It also demonstrates using Shared Objects as notifications to recognize the addition and removal of parties broadcasting.
Conference – Stream Manager
Demonstrates multi-party communication using Red5 Pro over Stream Manager. It also demonstrates using Shared Objects as notifications to recognize the addition and removal of parties broadcasting.

Subscribing

Subscriber
Basic subscriber example with failover.
i.e, if no WebRTC browser support, then first Flash Player is detected, then HLS.
360
Example for subscribing to a 360 camera stream
Audio Only
Demonstrates playback of audio-only stream.
Authentication
Demonstrates authentication with the Simple-Auth-Plugin for subscribing.
Image Capture
Demonstrates capturing an image of a live video being consumed.
Cluster
Demonstrates accessing an IP from the Red5 Pro Cluster API to subcribe to a live stream.
HLS
This is an example of subscribing to a stream using HLS Only. In the event that HLS is not supported natively by the browser, the hls.js 3rd-party library is utilized.
Image Capture
This example demonstrates capturing a still of the playback by using the drawImage API of CanvasRenderingContext2D.
Reconnect
Demonstrates the failover mechanism of the Red5 Pro HTML SDK to select a subscriber based on browser support and to auto-reconnect on close of broadcast or loss of connection.
Remote Call
Demonstrates receiving a remote message from broadcaster.
Retry on Invalid Name
Demonstrates utilizing the maintainConnectionOnSubscribeErrors configuration property of a subscriber in order to maintain the WebSocket connection upon errors from the subscribe request after intializing..
Round Trip Authentication
An example of utilizing round-trip authentication with Red5 Pro over Stream Manager Proxy
Screen Share
An example of utilizing the screen sharing capabilities of Chrome and Firefox. For use with Publish Screen Share example.
Standby
An example of using the Standby API to request a \”pause\” in receiving video and audio data on the MediaStream while also maintaining a connection of the client to the server.
Stream Switch
An example that demonstrates switching of the current subscriber\’s stream to another live stream through WebRTC.
Two Streams
An example that subscribes to two streams, using the Stream1 Name and Stream 2 Name variables from the settings page.
Video Mute
Example to demonstrate subscribing to a broadcast which has its video stream \”muted\”.
VP8
Demonstrates requesting VP8 Video Encoding for a playback stream.

Subscribing – Stream Manager Examples

Stream Manager
Demonstrates utilizing the Red5 Pro Stream Manager API, and acting as SSL WebSocket Proxy, to access an Edge server IP to subscribe to a live stream.
Stream Manager Proxy
Demonstrates utilizing the Red5 Pro Stream Manager API to access an Edge server IP to subscribe to a live stream.
Stream Manager Proxy Reconnect
Demonstrates the failover mechanism of the Red5 Pro HTML SDK to select a subscriber based on browser support and to auto-reconnect on close of broadcast or loss of connection.
Stream Manager Proxy Region
Demonstrates utilizing the Red5 Pro Stream Manager API to access an Edge server IP to subscribe to a live stream.
Stream Manager Proxy Round Trip Authentication
Demonstrates subscribing using round trip authentication, region specified.
Stream Manager Proxy Transcoder (RTC)
Demonstrates utilizing the Red5 Pro Stream Manager API to access Provisions and an Edge server IP to subscribe to a live WebRTC-based stream with Adaptive Bitrate Control.
Stream Manager Proxy Transcoder (RTMP)
Demonstrates utilizing the Red5 Pro Stream Manager API to access Provisions and an Edge server IP to subscribe to a live Flash-based stream with Adaptive Bitrate Control.
Stream Manager Proxy Transcoder (HLS)
Demonstrates utilizing the Red5 Pro Stream Manager API to access Provisions and an Edge server IP to subscribe to a live HLS-based stream with Adaptive Bitrate Control.
Stream Manager Proxy Screen Share
An example of utilizing the screen sharing capabilities of Chrome and Firefox. For use with Publish Screen Share example.

Mixer – Stream Manager Examples

Stream Manager Proxy Conference Participant
Demonstrates utilizing the Red5 Pro Stream Manager API to join a video conference with a single return stream.
Stream Manager Proxy Conference Host
Demonstrates utilizing the Red5 Pro Stream Manager API to host and manage a video conference with a single return stream.
Stream Manager Grid Composition Host
Demonstrates utilizing the Red5 Pro Stream Manager API to create and manage a composition of several live streams into a single stream.
Stream Manager 2×2 Grid Layout Example
Demonstrates composing a set of live streams into a 2×2 grid that can be loaded into a Red5 Pro Mixer to create a composition with up to 4 streams.
Stream Manager 3×3 Grid Layout Example
Demonstrates composing a set of live streams into a 3×3 grid that can be loaded into a Red5 Pro Mixer to create a composition with up to 9 streams.
Stream Manager NxN Grid Layout Example
Demonstrates composing a set of live streams into a NxN grid that can automatically resize as new streams are added to it. The page can be loaded into a Red5 Pro Mixer to create a composition with many streams.
Stream Manager Conference Layout
Demonstrates composing a set of live streams into a focused layout for a video conference where the presenter is highlighted. The page can be loaded into a Red5 Pro Mixer to create a video conference with a single return stream.

Notes

  1. For the Subscriber examples, you will need to have a live stream currently being published and named based on the Stream 1 Name field of the Settings. You can use another device to start streaming using this webapp, or you can also use a web browser to publish via Flash, http://your_re*d**5_pro_server_ip:5080/live.
  2. You can see a list of active streams by navigating to http://y*o*ur_re*d5_pro_server_ip:5080/live/subscribe.jsp (will need to refresh this page after you have started publishing).
  3. You can access the server IP of your Red5 Pro Server install – to be used in the Host field of the Settings – by opening http://yo*ur_r**ed5_pro_server_ip:5080/ and finding the IP printed in the upper-right of the page.
  4. Unless you are running the server locally, WebRTC publishing requires a valid SSL certificate.

下载源码

通过命令行克隆项目:

git clone https://github.com/red5pro/streaming-html5.git

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

申明:本文由第三方发布,内容仅代表作者观点,与本网站无关。对本文以及其中全部或者部分内容的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。本网发布或转载文章出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,也不代表本网对其真实性负责。

左子网 建站资源 streaming html5 https://www.zuozi.net/34745.html

常见问题
  • 1、自动:拍下后,点击(下载)链接即可下载;2、手动:拍下后,联系卖家发放即可或者联系官方找开发者发货。
查看详情
  • 1、源码默认交易周期:手动发货商品为1-3天,并且用户付款金额将会进入平台担保直到交易完成或者3-7天即可发放,如遇纠纷无限期延长收款金额直至纠纷解决或者退款!;
查看详情
  • 1、描述:源码描述(含标题)与实际源码不一致的(例:货不对板); 2、演示:有演示站时,与实际源码小于95%一致的(但描述中有”不保证完全一样、有变化的可能性”类似显著声明的除外); 3、发货:不发货可无理由退款; 4、安装:免费提供安装服务的源码但卖家不履行的; 5、收费:价格虚标,额外收取其他费用的(但描述中有显著声明或双方交易前有商定的除外); 6、其他:如质量方面的硬性常规问题BUG等。 注:经核实符合上述任一,均支持退款,但卖家予以积极解决问题则除外。
查看详情
  • 1、左子会对双方交易的过程及交易商品的快照进行永久存档,以确保交易的真实、有效、安全! 2、左子无法对如“永久包更新”、“永久技术支持”等类似交易之后的商家承诺做担保,请买家自行鉴别; 3、在源码同时有网站演示与图片演示,且站演与图演不一致时,默认按图演作为纠纷评判依据(特别声明或有商定除外); 4、在没有”无任何正当退款依据”的前提下,商品写有”一旦售出,概不支持退款”等类似的声明,视为无效声明; 5、在未拍下前,双方在QQ上所商定的交易内容,亦可成为纠纷评判依据(商定与描述冲突时,商定为准); 6、因聊天记录可作为纠纷评判依据,故双方联系时,只与对方在左子上所留的QQ、手机号沟通,以防对方不承认自我承诺。 7、虽然交易产生纠纷的几率很小,但一定要保留如聊天记录、手机短信等这样的重要信息,以防产生纠纷时便于左子介入快速处理。
查看详情

相关文章

猜你喜欢
发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务