mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Player: Support nginx-http-flv-module stream url. (#3305)
This commit is contained in:
parent
476a32d417
commit
c39edf4788
1 changed files with 21 additions and 16 deletions
|
@ -188,22 +188,6 @@
|
||||||
return;
|
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.
|
// Start play HTTP-TS.
|
||||||
if (r.stream.indexOf('.ts') > 0) {
|
if (r.stream.indexOf('.ts') > 0) {
|
||||||
if (!mpegts.getFeatureList().mseLivePlayback) {
|
if (!mpegts.getFeatureList().mseLivePlayback) {
|
||||||
|
@ -244,6 +228,27 @@
|
||||||
return;
|
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_ok();
|
||||||
|
|
||||||
|
flvPlayer = mpegts.createPlayer({type: 'flv', url: r.url, isLive: true});
|
||||||
|
flvPlayer.attachMediaElement(document.getElementById('video_player'));
|
||||||
|
flvPlayer.load();
|
||||||
|
flvPlayer.play();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
console.error('不支持的URL', r.url, r);
|
console.error('不支持的URL', r.url, r);
|
||||||
$('#video_player').hide();
|
$('#video_player').hide();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue