简体   繁体   English

加载视频后,Vimeo播放器enableTextTrack

[英]Vimeo player enableTextTrack after loadVideo

I'm trying to force the credit to be one after changing the video with loadVideo function. 在尝试使用loadVideo功能更改视频后,我试图强制将功劳设为1。 Not sure I'm doing things the proper way, or if this is a bug in the API. 不确定我是否以正确的方式执行操作,或者这是否是API中的错误。 Any one manage to make it work ? 有人设法使它起作用吗?

var options01 = {
  id: 76979871,
  autoplay:true
};

var vimeoPlayer = new Vimeo.Player('player_1', options01);
vimeoPlayer.enableTextTrack('fr').then(function(track) {
    // track.language = the iso code for the language
    // track.kind = 'captions' or 'subtitles'
    // track.label = the human-readable label
}).catch(function(error) {
    console.log(error.name);
});

$( ".changevideo" ).on( "click", function() {
  var id = $(this).data('vimeoid');
  vimeoPlayer.loadVideo(id).then(function(id) {
    vimeoPlayer.enableTextTrack('fr').then(function(track) {
    }).catch(function(error) {
      console.log(error.name);
    });
  });
});

https://codepen.io/romainmalauzat/pen/xyvyVW?editors=0010 https://codepen.io/romainmalauzat/pen/xyvyVW?editors=0010

Ok, I have finally used destroy, and rebuild the player each time. 好的,我终于使用了destroy,并且每次都重新构建播放器。 it's a hack, and shouldn't be the way, but that's all I have for now. 这是一个hack,不应该这样,但这就是我目前所拥有的。

If any one as a better solution, I'm all ears. 如果有谁能提供更好的解决方案,我将不知所措。 Thanks. 谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM