From 6f66cf08683cc70f1a030ea5a580ba99cd987717 Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 24 Apr 2021 19:38:49 +0800 Subject: [PATCH] Player: Change the default from RTMP to HTTP-FLV. --- README.md | 1 + trunk/research/players/js/srs.page.js | 24 +++++++++---------- trunk/research/players/srs_gb28181.html | 9 ++++--- trunk/research/players/srs_player.html | 5 ++-- .../players/srs_player_deprecated.html | 5 ++-- .../research/players/srs_publisher_flash.html | 5 ++-- 6 files changed, 23 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 65c1c01b71..2e79a70cb6 100755 --- a/README.md +++ b/README.md @@ -191,6 +191,7 @@ Other documents: ## 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-01, RTC: Refine TWCC and SDP exchange. 4.0.88 * v4.0, 2021-03-24, RTC: Support WebRTC re-publish stream. 4.0.87 diff --git a/trunk/research/players/js/srs.page.js b/trunk/research/players/js/srs.page.js index 2c49841c7b..dbf4e7b6eb 100755 --- a/trunk/research/players/js/srs.page.js +++ b/trunk/research/players/js/srs.page.js @@ -61,20 +61,20 @@ function is_default_port(schema, port) { /** @param server the ip of server. default to window.location.hostname -@param vhost the vhost of rtmp. default to window.location.hostname -@param port the port of rtmp. default to 1935 -@param app the app of rtmp. default to live. -@param stream the stream of rtmp. default to livestream. +@param vhost the vhost of HTTP-FLV. default to window.location.hostname +@param port the port of HTTP-FLV. default to 1935 +@param app the app of HTTP-FLV. default to live. +@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 schema = (!query.schema)? "rtmp":query.schema; + var schema = (!query.schema)? "http":query.schema; 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 app = (!query.app)? "live":query.app; - var stream = (!query.stream)? "livestream":query.stream; + var stream = (!query.stream)? "livestream.flv":query.stream; var queries = []; if (server !== vhost && vhost !== "__defaultVhost__") { @@ -147,14 +147,14 @@ function build_default_rtc_url(query) { /** * 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 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(); - if (rtmp_url) { - $(rtmp_url).val(build_default_rtmp_url()); + if (flv_url) { + $(flv_url).val(build_default_flv_url()); } if (modal_player) { $(modal_player).width(srs_get_player_modal() + "px"); diff --git a/trunk/research/players/srs_gb28181.html b/trunk/research/players/srs_gb28181.html index b36ca886f5..99f1388e2e 100644 --- a/trunk/research/players/srs_gb28181.html +++ b/trunk/research/players/srs_gb28181.html @@ -752,12 +752,11 @@

创建通道

*/ var autoLoadPage = function() { var query = parse_query_string(); - + // 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: rtmp://demo:1935/live/livestream - srs_init_rtmp("#txt_url", "#main_modal"); - srs_init_rtmp("#txt_url", "#rtc_player_modal"); + // url set to: http://localhost:8080/live/livestream.flv + srs_init_flv("#txt_url", "#main_modal"); + srs_init_flv("#txt_url", "#rtc_player_modal"); // 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]; diff --git a/trunk/research/players/srs_player.html b/trunk/research/players/srs_player.html index d4530c4cc0..470a1a58dd 100755 --- a/trunk/research/players/srs_player.html +++ b/trunk/research/players/srs_player.html @@ -247,9 +247,8 @@ var query = parse_query_string(); // 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: rtmp://demo:1935/live/livestream - srs_init_rtmp("#txt_url"); + // url set to: http://localhost:8080/live/livestream.flv + srs_init_flv("#txt_url"); if (query.autostart === "true") { $('#video_player').prop('muted', true); diff --git a/trunk/research/players/srs_player_deprecated.html b/trunk/research/players/srs_player_deprecated.html index e271041819..5ee5b0af29 100755 --- a/trunk/research/players/srs_player_deprecated.html +++ b/trunk/research/players/srs_player_deprecated.html @@ -421,9 +421,8 @@

SrsPlayer

var query = parse_query_string(); // 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: rtmp://demo:1935/live/livestream - srs_init_rtmp("#txt_url", "#main_modal"); + // url set to: http://localhost:8080/live/livestream.flv + srs_init_flv("#txt_url", "#main_modal"); // 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]; diff --git a/trunk/research/players/srs_publisher_flash.html b/trunk/research/players/srs_publisher_flash.html index e04e7a174b..c5de8c1756 100644 --- a/trunk/research/players/srs_publisher_flash.html +++ b/trunk/research/players/srs_publisher_flash.html @@ -310,9 +310,8 @@

音频编码

var query = parse_query_string(); var autoLoadPage = function() { // 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: rtmp://demo:1935/live/livestream - srs_init_rtmp("#txt_url", null); + // url set to: http://localhost:8080/live/livestream.flv + srs_init_flv("#txt_url", null); if (query.agent == "true") { document.write(navigator.userAgent);