簡體   English   中英

Vimeo js API 加載視頻

[英]Vimeo js API load video

我正在一個帶有選項的播放器中加載一個新的 vimeo id。 視頻已加載並可在播放器內播放,但未使用選項(肖像、標題、..)。

這是用於創建播放器的代碼(准備就緒)

var iframe = $('#vimeoContainer');
var options = {
    id : 191611447,
    portrait: 0,
    title : 0,
    byline: 0,
};

var player = new Vimeo.Player(iframe, options);

這是在此播放器中加載視頻的代碼

  player.loadVideo(sl).then(function(id) {
// the video successfully loaded
}).catch(function(error) {
switch (error.name) {
    case 'TypeError':
        // the id was not a number
        break;

    case 'PasswordError':
        // the video is password-protected and the viewer needs to enter the
        // password first
        break;

    case 'PrivacyError':
        // the video is password-protected or private
        break;

    default:
        // some other error occurred
        break;
}
});

感謝您的幫助和時間

您將 title 和 byline 設置為 0 (false),因此不會顯示 title 和 byline,您會得到所需的內容。 要解決此問題,請不要設置選項(刪除它)或將其設置為 1/true。

var options = {
    id : 191611447,
    portrait: 0,
    title : true, // its the default anyway
    byline: true, // its the default anyway
};

或者:

var options = {
    id : 191611447,
    portrait: 0,
};

更多信息: https : //developer.vimeo.com/player/sdk/embed

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM