我需要能够从VideoJs的TextTracks对象中获取Cues数组。
我有以下代码:
我有以下代码:
videojs("example_video_1", {}, function(){
// Player (this) is initialized and ready.
var aTextTrack = this.textTracks()[0];
aTextTrack.show();
var theArray = this.textTracks()[0]['$'];
console.log(theArray);
console.dir(this.textTracks()[0]['$']);
// EXAMPLE: Start playing the video.
this.play();
});
变量 theArray 打印为空,但是 console.dir 打印了数组的内容。我该如何获取这些值呢?我知道这与 JavaScript 异步变量有关。
谢谢