1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 03:41:55 +00:00

dump logs

This commit is contained in:
winlin 2016-03-19 10:18:11 +08:00
parent 9ab5039b36
commit 0a2e00f8c5
4 changed files with 24 additions and 0 deletions

View file

@ -163,6 +163,12 @@ SrsPlayer.prototype.fluency = function() {
SrsPlayer.prototype.empty_count = function() {
return this.__fluency.total_empty_count;
}
/**
* get all log data.
*/
SrsPlayer.prototype.dump_log = function() {
return this.callbackObj.ref.__dump_log();
}
/**
* to set the DAR, for example, DAR=16:9 where num=16,den=9.
* @param num, for example, 16.

View file

@ -561,6 +561,9 @@
$("#main_modal").on("hide", function(){
if (srs_player) {
// report the log to backend.
console.log(srs_player.dump_log());
srs_player.stop();
srs_player = null;
}

View file

@ -8,6 +8,11 @@ package
*/
public class Utility
{
/**
* total log.
*/
public static var logData:String = "";
/**
* initialize the player by flashvars for config.
* @param flashvars the config.
@ -23,6 +28,8 @@ package
public static function log(js_id:String, msg:String):void {
msg = "[" + new Date() +"][srs-player][" + js_id + "] " + msg;
logData += msg + "\n";
trace(msg);
if (!flash.external.ExternalInterface.available) {

View file

@ -131,6 +131,7 @@ package
flash.external.ExternalInterface.addCallback("__set_fs", this.js_call_set_fs_size);
flash.external.ExternalInterface.addCallback("__set_bt", this.js_call_set_bt);
flash.external.ExternalInterface.addCallback("__set_mbt", this.js_call_set_mbt);
flash.external.ExternalInterface.addCallback("__dump_log", this.js_call_dump_log);
flash.external.ExternalInterface.call(this.js_on_player_ready, this.js_id);
}
@ -273,6 +274,13 @@ package
log("user resume play");
}
}
/**
* dumps all log data.
*/
private function js_call_dump_log():String {
return Utility.logData;
}
/**
* to set the DAR, for example, DAR=16:9 where num=16,den=9.