Embed: give a player instance a number and show it in the console log

This commit is contained in:
Cat 2021-07-22 13:13:25 +02:00 committed by Thulinma
parent 8e8017dfd9
commit 4f1962b9b0
2 changed files with 5 additions and 2 deletions

File diff suppressed because one or more lines are too long

View file

@ -40,6 +40,9 @@ function MistVideo(streamName,options) {
this.options = options;
this.stream = streamName;
this.info = false;
if (!window.MistInstances) { window.MistInstances = 0;}
window.MistInstances++;
this.n = window.MistInstances;
this.logs = [];
this.log = function(message,type){
if (!type) { type = "log"; }
@ -54,7 +57,7 @@ function MistVideo(streamName,options) {
});
if (this.options.skin == "dev") {
try {
var msg = "["+(type ? type :"log")+"] "+(MistVideo.destroyed ? "[DESTROYED] " : "")+(this.player && this.player.api ? MistUtil.format.time(this.player.api.currentTime,{ms:true})+" " : "")+message;
var msg = "["+(type ? type :"log")+"] "+(MistVideo.destroyed ? "[DESTROYED] " : "")+"[#"+(MistVideo.n)+"] "+(this.player && this.player.api ? MistUtil.format.time(this.player.api.currentTime,{ms:true})+" " : "")+message;
if (type && (type != "log")) { console.warn(msg); }
else { console.log(msg); }
} catch(e){}