diff --git a/trunk/research/api-server/server.py b/trunk/research/api-server/server.py index 5e860145f..99918cd87 100755 --- a/trunk/research/api-server/server.py +++ b/trunk/research/api-server/server.py @@ -343,7 +343,7 @@ class RESTChats(object): self.__chat_lock = threading.Lock(); # dead time in seconds, if exceed, remove the chat. - self.__dead_time = 30; + self.__dead_time = 15; def GET(self): enable_crossdomain() diff --git a/trunk/research/players/js/srs.player.js b/trunk/research/players/js/srs.player.js old mode 100644 new mode 100755 diff --git a/trunk/research/players/js/srs.publisher.js b/trunk/research/players/js/srs.publisher.js old mode 100644 new mode 100755 index 43823b744..b46d51ef7 --- a/trunk/research/players/js/srs.publisher.js +++ b/trunk/research/players/js/srs.publisher.js @@ -35,9 +35,12 @@ function SrsPublisher(container, width, height, private_object) { // error code defines. this.errors = { - "100": "无法获取指定的摄像头", //error_camera_get - "101": "无法获取指定的麦克风", //error_microphone_get - "102": "摄像头为禁用状态,推流时请允许flash访问摄像头" //error_camera_muted + "100": "无法获取指定的摄像头。", //error_camera_get + "101": "无法获取指定的麦克风。", //error_microphone_get + "102": "摄像头为禁用状态,推流时请允许flash访问摄像头。", //error_camera_muted + "103": "服务器关闭了连接。", //error_connection_closed + "104": "服务器连接失败。", //error_connection_failed + "199": "未知错误。" }; } /** @@ -84,11 +87,17 @@ SrsPublisher.prototype.start = function() { * @param acodec an object contains the audio codec info. */ SrsPublisher.prototype.publish = function(url, vcodec, acodec) { - this.url = url; - this.vcodec = vcodec; - this.acodec = acodec; + if (url) { + this.url = url; + } + if (vcodec) { + this.vcodec = vcodec; + } + if (acodec) { + this.acodec = acodec; + } - this.callbackObj.ref.__publish(url, this.width, this.height, vcodec, acodec); + this.callbackObj.ref.__publish(this.url, this.width, this.height, this.vcodec, this.acodec); } SrsPublisher.prototype.stop = function() { this.callbackObj.ref.__stop(); diff --git a/trunk/research/players/srs_chat.html b/trunk/research/players/srs_chat.html index 06c6c9600..23de8b3f3 100755 --- a/trunk/research/players/srs_chat.html +++ b/trunk/research/players/srs_chat.html @@ -64,7 +64,7 @@ ); }; srs_publisher.on_publisher_error = function(code, desc) { - error(code, desc); + error(code, desc + "请重试。"); }; srs_publisher.on_publisher_warn = function(code, desc) { warn(code, desc); @@ -78,6 +78,7 @@ realtime_player = new SrsPlayer("realtime_player", 430, 185); realtime_player.on_player_ready = function() { this.set_bt(0.5); + this.set_fs("screen", 100); }; realtime_player.start(); } @@ -229,7 +230,6 @@ var _player = new SrsPlayer("rp_raw_" + chat.id, 600, 300, chat); _player.on_player_ready = function() { this.set_bt(0.5); - this.play(); this.set_fs("screen", 100); }; _player.start(chat.url); @@ -254,7 +254,6 @@ return; } chat.player.play(); - chat.player.set_fs("screen", 100); }); } @@ -419,14 +418,13 @@ $("#btn_join").text("退出会议"); - info("开始推流到服务器。请戴耳机聊天,否则音箱的声音会进入麦克风"); + info("开始推流到服务器。请戴耳机聊天,否则音箱的声音会进入麦克风造成回声。"); srs_publisher.publish(url, vcodec, acodec); if (realtime_player) { // directly play the url for the realtime player. realtime_player.stop(); realtime_player.play(url, 0); - realtime_player.set_fs("screen", 100); } } }); @@ -513,7 +511,7 @@ -
+
diff --git a/trunk/research/players/srs_publisher.html b/trunk/research/players/srs_publisher.html index c48df777f..b587720f8 100755 --- a/trunk/research/players/srs_publisher.html +++ b/trunk/research/players/srs_publisher.html @@ -64,7 +64,7 @@ ); }; srs_publisher.on_publisher_error = function(code, desc) { - error(code, desc); + error(code, desc + "请重试。"); }; srs_publisher.on_publisher_warn = function(code, desc) { warn(code, desc); diff --git a/trunk/research/players/srs_publisher/release/srs_publisher.swf b/trunk/research/players/srs_publisher/release/srs_publisher.swf index 600127ded..c4d2fd2fe 100755 Binary files a/trunk/research/players/srs_publisher/release/srs_publisher.swf and b/trunk/research/players/srs_publisher/release/srs_publisher.swf differ diff --git a/trunk/research/players/srs_publisher/src/srs_publisher.as b/trunk/research/players/srs_publisher/src/srs_publisher.as index 8d63004d3..3a4458e5f 100755 --- a/trunk/research/players/srs_publisher/src/srs_publisher.as +++ b/trunk/research/players/srs_publisher/src/srs_publisher.as @@ -48,6 +48,8 @@ package private const error_camera_get:int = 100; private const error_microphone_get:int = 101; private const error_camera_muted:int = 102; + private const error_connection_closed:int = 103; + private const error_connection_failed:int = 104; public function srs_publisher() { @@ -181,6 +183,17 @@ package } contextMenu.customItems = customItems; } + + if (evt.info.code == "NetConnection.Connect.Closed") { + js_call_stop(); + system_error(error_connection_closed, "server closed the connection"); + return; + } + if (evt.info.code == "NetConnection.Connect.Failed") { + js_call_stop(); + system_error(error_connection_failed, "connect to server failed"); + return; + } // TODO: FIXME: failed event. if (evt.info.code != "NetConnection.Connect.Success") {