我确实包含yt-iframe_api。我可以轻松创建新的YT.Player()。
但是我确实有多个视频。所以我要做以下
players[video_1] = new YT.Player(video_1);
players[video_2] = new YT.Player(video_2);
....
var active = players[video_2];
active.playVideo();
/*... some actions...*/
var active = players[video_1];
active.playVideo();
工作正常。但是当我再次执行一些操作video_2时,所有来自youtube的get-objects-functions,例如getApiInterface,getAvailablePlaybackRates都消失了。:
var active = players[video_2];
active.playVideo();
Y {b: Wa, a: iframe#index-bx-iframe-M5YkXpMWUk.index-bx-
A: true
a: iframe#index-bx-iframe-M5YkXpMWUk.index-bx-iframe.fadeIn
addCueRange: ƒ ()
b: Wa {b: {…}, f: {…}, a: true, c: true}
c: 13
clearVideo: ƒ ()
closure_uid_432119990: 1
cuePlaylist: ƒ ()
cueVideoById: ƒ ()
cueVideoByUrl: ƒ ()
f: M {c: false, f: undefined, l: 4, g: Array(0), h: 0, …}
g: 1
getApiInterface: ƒ () /* This disappears on 2nd time */
getAvailablePlaybackRates: ƒ () /* This disappears on 2nd time */
getAvailableQualityLevels: ƒ () /* This disappears on 2nd time */
....
如何避免仍然可以播放视频?你明白了吗?就像来自YT.Player的吸气剂一样。