1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 11:51:57 +00:00

Player: Change the default from RTMP to HTTP-FLV.

This commit is contained in:
winlin 2021-04-24 19:38:49 +08:00
parent 5232f9e043
commit 6f66cf0868
6 changed files with 23 additions and 26 deletions

View file

@ -191,6 +191,7 @@ Other documents:
## V4 changes ## V4 changes
* v4.0, 2021-04-24, Player: Change the default from RTMP to HTTP-FLV.
* v4.0, 2021-04-24, Disable CherryPy by --cherrypy=off. 4.0.90 * v4.0, 2021-04-24, Disable CherryPy by --cherrypy=off. 4.0.90
* v4.0, 2021-04-01, RTC: Refine TWCC and SDP exchange. 4.0.88 * v4.0, 2021-04-01, RTC: Refine TWCC and SDP exchange. 4.0.88
* v4.0, 2021-03-24, RTC: Support WebRTC re-publish stream. 4.0.87 * v4.0, 2021-03-24, RTC: Support WebRTC re-publish stream. 4.0.87

View file

@ -61,20 +61,20 @@ function is_default_port(schema, port) {
/** /**
@param server the ip of server. default to window.location.hostname @param server the ip of server. default to window.location.hostname
@param vhost the vhost of rtmp. default to window.location.hostname @param vhost the vhost of HTTP-FLV. default to window.location.hostname
@param port the port of rtmp. default to 1935 @param port the port of HTTP-FLV. default to 1935
@param app the app of rtmp. default to live. @param app the app of HTTP-FLV. default to live.
@param stream the stream of rtmp. default to livestream. @param stream the stream of HTTP-FLV. default to livestream.flv
*/ */
function build_default_rtmp_url() { function build_default_flv_url() {
var query = parse_query_string(); var query = parse_query_string();
var schema = (!query.schema)? "rtmp":query.schema; var schema = (!query.schema)? "http":query.schema;
var server = (!query.server)? window.location.hostname:query.server; var server = (!query.server)? window.location.hostname:query.server;
var port = (!query.port)? (schema==="http"? 80:1935) : Number(query.port); var port = (!query.port)? (schema==="http"? 8080:1935) : Number(query.port);
var vhost = (!query.vhost)? window.location.hostname:query.vhost; var vhost = (!query.vhost)? window.location.hostname:query.vhost;
var app = (!query.app)? "live":query.app; var app = (!query.app)? "live":query.app;
var stream = (!query.stream)? "livestream":query.stream; var stream = (!query.stream)? "livestream.flv":query.stream;
var queries = []; var queries = [];
if (server !== vhost && vhost !== "__defaultVhost__") { if (server !== vhost && vhost !== "__defaultVhost__") {
@ -147,14 +147,14 @@ function build_default_rtc_url(query) {
/** /**
* initialize the page. * initialize the page.
* @param rtmp_url the div id contains the rtmp stream url to play * @param flv_url the div id contains the flv stream url to play
* @param hls_url the div id contains the hls stream url to play * @param hls_url the div id contains the hls stream url to play
* @param modal_player the div id contains the modal player * @param modal_player the div id contains the modal player
*/ */
function srs_init_rtmp(rtmp_url, modal_player) { function srs_init_flv(flv_url, modal_player) {
update_nav(); update_nav();
if (rtmp_url) { if (flv_url) {
$(rtmp_url).val(build_default_rtmp_url()); $(flv_url).val(build_default_flv_url());
} }
if (modal_player) { if (modal_player) {
$(modal_player).width(srs_get_player_modal() + "px"); $(modal_player).width(srs_get_player_modal() + "px");

View file

@ -754,10 +754,9 @@
var query = parse_query_string(); var query = parse_query_string();
// get the vhost and port to set the default url. // get the vhost and port to set the default url.
// for example: http://192.168.1.213/players/srs_player.html?port=1935&vhost=demo // url set to: http://localhost:8080/live/livestream.flv
// url set to: rtmp://demo:1935/live/livestream srs_init_flv("#txt_url", "#main_modal");
srs_init_rtmp("#txt_url", "#main_modal"); srs_init_flv("#txt_url", "#rtc_player_modal");
srs_init_rtmp("#txt_url", "#rtc_player_modal");
// consts for buffer and max buffer. // consts for buffer and max buffer.
var bts = [0.1, 0.2, 0.3, 0.5, 0.8, 1, 2, 3, 4, 5, 6, 8, 10, 15, 20, 30]; var bts = [0.1, 0.2, 0.3, 0.5, 0.8, 1, 2, 3, 4, 5, 6, 8, 10, 15, 20, 30];

View file

@ -247,9 +247,8 @@
var query = parse_query_string(); var query = parse_query_string();
// get the vhost and port to set the default url. // get the vhost and port to set the default url.
// for example: http://192.168.1.213/players/srs_player.html?port=1935&vhost=demo // url set to: http://localhost:8080/live/livestream.flv
// url set to: rtmp://demo:1935/live/livestream srs_init_flv("#txt_url");
srs_init_rtmp("#txt_url");
if (query.autostart === "true") { if (query.autostart === "true") {
$('#video_player').prop('muted', true); $('#video_player').prop('muted', true);

View file

@ -421,9 +421,8 @@
var query = parse_query_string(); var query = parse_query_string();
// get the vhost and port to set the default url. // get the vhost and port to set the default url.
// for example: http://192.168.1.213/players/srs_player.html?port=1935&vhost=demo // url set to: http://localhost:8080/live/livestream.flv
// url set to: rtmp://demo:1935/live/livestream srs_init_flv("#txt_url", "#main_modal");
srs_init_rtmp("#txt_url", "#main_modal");
// consts for buffer and max buffer. // consts for buffer and max buffer.
var bts = [0.1, 0.2, 0.3, 0.5, 0.8, 1, 2, 3, 4, 5, 6, 8, 10, 15, 20, 30]; var bts = [0.1, 0.2, 0.3, 0.5, 0.8, 1, 2, 3, 4, 5, 6, 8, 10, 15, 20, 30];

View file

@ -310,9 +310,8 @@
var query = parse_query_string(); var query = parse_query_string();
var autoLoadPage = function() { var autoLoadPage = function() {
// get the vhost and port to set the default url. // get the vhost and port to set the default url.
// for example: http://192.168.1.213/players/srs_player.html?port=1935&vhost=demo // url set to: http://localhost:8080/live/livestream.flv
// url set to: rtmp://demo:1935/live/livestream srs_init_flv("#txt_url", null);
srs_init_rtmp("#txt_url", null);
if (query.agent == "true") { if (query.agent == "true") {
document.write(navigator.userAgent); document.write(navigator.userAgent);