0

我有嵌入视频的问题。我使用“Embed.ly API”和“player.js”: https ://docs.embed.ly/docs/oembed

https://docs.embed.ly/docs/playerjs

我正在尝试在我的网站上嵌入来自“youku.com”的视频。“youku.com”是一个内容提供商,如下所述:https ://embed.ly/providers 添加了视频,但播放器的方法(播放、暂停等)不适用于视频。但是,如果我将视频服务从“youku.com”更改为“youtube.com”并使用“youtube.com”中的视频,那么方法效果很好。

我还尝试连接“platform.js”而不是播放器。结果是一样的。也许“player.js”之前工作过,我猜“youku.com”已经改变了它的API,但“player.js”没有跟踪变化。

player.js 现在真的可以和“优酷网”一起使用了吗?也许应该在我的代码中添加一些东西来解决问题?我不在中国,因为“优酷网”是中文服务,会不会有什么影响?

谢谢。

我的代码js:(还有一个问题:代码有错误吗?

      var obj_json = $.getJSON('https://api.embedly.com/1/oembed?' + $.param({
    url: :url,  // for example:  https://v.youku.com/v_show/id_XMzg2MjgwNzA0OA==.html 
    key: :key  // my_API_key
  })).done(function () {
    $('.embeded').html(obj_json.responseJSON.html).find('iframe.embedly-embed').each(function () {

      // initialize the player.
      var player = new playerjs.Player(this);

      player.on('ready', function () {
        player.setLoop(true); // it is not work 
        player.play(); // it is not work 
        //..................................
        //  There are also special buttons on the page, clicking on which the video should start or stop:
       $('.button_play').click(function () { 
            player.play();  // pressing occurs, but player it is not work 
        });
        $('.button_pause').click(function () { 
            player.pause();  // pressing occurs, but player it is not work 
        });
        //.........................................
      });
     });
    });
4

0 回答 0