mirror of
https://github.com/ossrs/srs.git
synced 2025-11-23 19:34:05 +08:00
Player: Support nginx-http-flv-module stream url. (#3305)
This commit is contained in:
@@ -188,22 +188,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) {
|
||||
@@ -244,6 +228,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_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);
|
||||
$('#video_player').hide();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user