1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

WHIP: Support DELETE resource for Larix Broadcaster. v5.0.148 v6.0.36 (#3427)

* WHIP: Support DELETE resource.
* Support push by Larix.
* FLV: Disable stash buffer for realtime.
* WHEP: Fix muted issue.

-------

Co-authored-by: chundonglinlin <chundonglinlin@163.com>
Co-authored-by: panda <542638787@qq.com>
This commit is contained in:
Winlin 2023-03-23 10:01:20 +08:00 committed by winlin
parent dfef94411f
commit 5cc794b22d
8 changed files with 98 additions and 61 deletions

View file

@ -83,7 +83,7 @@ function SrsRtcPublisherAsync() {
const xhr = new XMLHttpRequest();
xhr.onload = function() {
if (xhr.readyState !== xhr.DONE) return;
if (xhr.status !== 200) return reject(xhr);
if (xhr.status !== 200 && xhr.status !== 201) return reject(xhr);
const data = JSON.parse(xhr.responseText);
console.log("Got answer: ", data);
return data.code ? reject(xhr) : resolve(data);
@ -318,7 +318,7 @@ function SrsRtcPlayerAsync() {
const xhr = new XMLHttpRequest();
xhr.onload = function() {
if (xhr.readyState !== xhr.DONE) return;
if (xhr.status !== 200) return reject(xhr);
if (xhr.status !== 200 && xhr.status !== 201) return reject(xhr);
const data = JSON.parse(xhr.responseText);
console.log("Got answer: ", data);
return data.code ? reject(xhr) : resolve(data);
@ -553,7 +553,7 @@ function SrsRtcWhipWhepAsync() {
const xhr = new XMLHttpRequest();
xhr.onload = function() {
if (xhr.readyState !== xhr.DONE) return;
if (xhr.status !== 200) return reject(xhr);
if (xhr.status !== 200 && xhr.status !== 201) return reject(xhr);
const data = xhr.responseText;
console.log("Got answer: ", data);
return data.code ? reject(xhr) : resolve(data);
@ -586,7 +586,7 @@ function SrsRtcWhipWhepAsync() {
const xhr = new XMLHttpRequest();
xhr.onload = function() {
if (xhr.readyState !== xhr.DONE) return;
if (xhr.status !== 200) return reject(xhr);
if (xhr.status !== 200 && xhr.status !== 201) return reject(xhr);
const data = xhr.responseText;
console.log("Got answer: ", data);
return data.code ? reject(xhr) : resolve(data);

View file

@ -190,22 +190,6 @@
return;
}
// Start play HTTP-FLV.
if (r.stream.indexOf('.flv') > 0) {
if (!mpegts.getFeatureList().mseLivePlayback) {
hide_for_error();
return;
}
show_for_ok();
flvPlayer = mpegts.createPlayer({type: 'flv', url: r.url, isLive: true});
flvPlayer.attachMediaElement(document.getElementById('video_player'));
flvPlayer.load();
flvPlayer.play();
return;
}
// Start play HTTP-TS.
if (r.stream.indexOf('.ts') > 0) {
if (!mpegts.getFeatureList().mseLivePlayback) {
@ -215,7 +199,7 @@
show_for_ok();
tsPlayer = mpegts.createPlayer({type: 'mpegts', url: r.url, isLive: true});
tsPlayer = mpegts.createPlayer({type: 'mpegts', url: r.url, isLive: true, enableStashBuffer: false});
tsPlayer.attachMediaElement(document.getElementById('video_player'));
tsPlayer.load();
tsPlayer.play();
@ -246,6 +230,27 @@
return;
}
// Start play HTTP-FLV.
let isFlv = r.stream.indexOf('.flv') > 0;
// Compatible with NGINX-HTTP-FLV module, see https://github.com/winshining/nginx-http-flv-module and the stream
// url without .flv, such as:
// http://localhost:8080/live?app=live&stream=livestream
isFlv = isFlv || r.stream && r.url.indexOf('http') === 0;
if (isFlv) {
if (!mpegts.getFeatureList().mseLivePlayback) {
hide_for_error();
return;
}
show_for_video_ok();
flvPlayer = mpegts.createPlayer({type: 'flv', url: r.url, isLive: true, enableStashBuffer: false});
flvPlayer.attachMediaElement(document.getElementById('video_player'));
flvPlayer.load();
flvPlayer.play();
return;
}
console.error('不支持的URL', r.url, r);
$('#video_player').hide();
};

View file

@ -52,7 +52,7 @@
</div>
<label></label>
<video id="rtc_media_player" width="320" autoplay muted></video>
<video id="rtc_media_player" controls autoplay></video>
<label></label>
SessionID: <span id='sessionid'></span>