0
我正在升級我的僅支持Flash的代碼,以支持Brightcove智能播放器,以便在HTML5之間自動切換。Brightcove智能播放器 - 作爲播放列表的多個視頻
我已經能夠讓單個視頻播放器切換沒有問題。在現有的代碼中,我可以通過在javascript中加載多個videoID來模擬播放列表。我的用戶不會在Brightcove中創建播放列表。他們可以在我們的CMS中輸入videoID,並且我可以動態加載它們。
這裏是舊代碼:
function onTemplateReady(e) {
videoList = exp.getElementByID("videoList");
if (videoList != null) {
var mediaIdsToRequest = videoIDs;
content.getMediaInGroupAsynch(mediaIdsToRequest);
}
videoLoading = false;
}
function onMediaCollectionLoad(e) {
if (e.mediaCollection != null) { // This means the mediaCollection is a Playlist or group of videos
var mediaDTOs = new Array();
for (var i = 0; i < e.mediaCollection.mediaCount; i++) {
mediaDTOs[i] = content.getMedia(e.mediaCollection.mediaIds[i]);
}
videoList.setData(mediaDTOs);
// Visually selects the first video in the list
videoList.setSelectedIndex(0);
// Cues up the first video of the list in the videoPlayer component but doesn't start playing it
video.cueVideo(mediaDTOs[0].id);
}
}
我們基本上包括一個名爲videoList參數是一個逗號分隔videoIDs的列表。問題似乎是MEDIA_COLLECTION_LOAD事件不在新的API中。現在推薦的方法是什麼?
看起來像VideoPlayer類可能正在處理這個。看看這個智能播放器解決方案:http://support.brightcove.com/en/docs/dynamically-loading-videos-using-smart-player-api – jco