Skip to content

Commit

Permalink
Player: Change the default from RTMP to HTTP-FLV.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Apr 24, 2021
1 parent 5232f9e commit 6f66cf0
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 26 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 12 additions & 12 deletions trunk/research/players/js/srs.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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__") {
Expand Down Expand Up @@ -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");
Expand Down
9 changes: 4 additions & 5 deletions trunk/research/players/srs_gb28181.html
Original file line number Diff line number Diff line change
Expand Up @@ -752,12 +752,11 @@ <h3>创建通道</h3>
*/
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];
Expand Down
5 changes: 2 additions & 3 deletions trunk/research/players/srs_player.html
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 2 additions & 3 deletions trunk/research/players/srs_player_deprecated.html
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,8 @@ <h3><a href="https://github.com/ossrs/srs">SrsPlayer</a></h3>
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];
Expand Down
5 changes: 2 additions & 3 deletions trunk/research/players/srs_publisher_flash.html
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,8 @@ <h3>音频编码</h3>
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);
Expand Down

0 comments on commit 6f66cf0

Please sign in to comment.