I am upgrading my flash-only code to support the Brightcove Smart Player so it auto switch between HTML5.
I have been able to get the single video player switched over without problem. In the existing code, I can simulate a playlist by loading multiple videoIDs in javascript. My users do not create playlists in Brightcove. They can enter the videoIDs in our CMS and I load them dynamically.
Here is the old code:
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);
}
}
We basically include a parameter called videoList that is a comma separated list of videoIDs. The problem seems to be that the MEDIA_COLLECTION_LOAD event is not in the new API. What is the recommend way to do this now?