winlin

dump logs

@@ -164,6 +164,12 @@ SrsPlayer.prototype.empty_count = function() { @@ -164,6 +164,12 @@ SrsPlayer.prototype.empty_count = function() {
164 return this.__fluency.total_empty_count; 164 return this.__fluency.total_empty_count;
165 } 165 }
166 /** 166 /**
  167 + * get all log data.
  168 + */
  169 +SrsPlayer.prototype.dump_log = function() {
  170 + return this.callbackObj.ref.__dump_log();
  171 +}
  172 +/**
167 * to set the DAR, for example, DAR=16:9 where num=16,den=9. 173 * to set the DAR, for example, DAR=16:9 where num=16,den=9.
168 * @param num, for example, 16. 174 * @param num, for example, 16.
169 * use metadata width if 0. 175 * use metadata width if 0.
@@ -561,6 +561,9 @@ @@ -561,6 +561,9 @@
561 561
562 $("#main_modal").on("hide", function(){ 562 $("#main_modal").on("hide", function(){
563 if (srs_player) { 563 if (srs_player) {
  564 + // report the log to backend.
  565 + console.log(srs_player.dump_log());
  566 +
564 srs_player.stop(); 567 srs_player.stop();
565 srs_player = null; 568 srs_player = null;
566 } 569 }
@@ -9,6 +9,11 @@ package @@ -9,6 +9,11 @@ package
9 public class Utility 9 public class Utility
10 { 10 {
11 /** 11 /**
  12 + * total log.
  13 + */
  14 + public static var logData:String = "";
  15 +
  16 + /**
12 * initialize the player by flashvars for config. 17 * initialize the player by flashvars for config.
13 * @param flashvars the config. 18 * @param flashvars the config.
14 */ 19 */
@@ -23,6 +28,8 @@ package @@ -23,6 +28,8 @@ package
23 public static function log(js_id:String, msg:String):void { 28 public static function log(js_id:String, msg:String):void {
24 msg = "[" + new Date() +"][srs-player][" + js_id + "] " + msg; 29 msg = "[" + new Date() +"][srs-player][" + js_id + "] " + msg;
25 30
  31 + logData += msg + "\n";
  32 +
26 trace(msg); 33 trace(msg);
27 34
28 if (!flash.external.ExternalInterface.available) { 35 if (!flash.external.ExternalInterface.available) {
@@ -131,6 +131,7 @@ package @@ -131,6 +131,7 @@ package
131 flash.external.ExternalInterface.addCallback("__set_fs", this.js_call_set_fs_size); 131 flash.external.ExternalInterface.addCallback("__set_fs", this.js_call_set_fs_size);
132 flash.external.ExternalInterface.addCallback("__set_bt", this.js_call_set_bt); 132 flash.external.ExternalInterface.addCallback("__set_bt", this.js_call_set_bt);
133 flash.external.ExternalInterface.addCallback("__set_mbt", this.js_call_set_mbt); 133 flash.external.ExternalInterface.addCallback("__set_mbt", this.js_call_set_mbt);
  134 + flash.external.ExternalInterface.addCallback("__dump_log", this.js_call_dump_log);
134 135
135 flash.external.ExternalInterface.call(this.js_on_player_ready, this.js_id); 136 flash.external.ExternalInterface.call(this.js_on_player_ready, this.js_id);
136 } 137 }
@@ -273,6 +274,13 @@ package @@ -273,6 +274,13 @@ package
273 log("user resume play"); 274 log("user resume play");
274 } 275 }
275 } 276 }
  277 +
  278 + /**
  279 + * dumps all log data.
  280 + */
  281 + private function js_call_dump_log():String {
  282 + return Utility.logData;
  283 + }
276 284
277 /** 285 /**
278 * to set the DAR, for example, DAR=16:9 where num=16,den=9. 286 * to set the DAR, for example, DAR=16:9 where num=16,den=9.