mirror of
https://github.com/ossrs/srs.git
synced 2025-02-13 03:41:55 +00:00
dump logs
This commit is contained in:
parent
9ab5039b36
commit
0a2e00f8c5
4 changed files with 24 additions and 0 deletions
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue