视频再现循环数组

时间:2013-04-03 15:52:32

标签: arrays video brightcove

我试图在brightcove中循环播放我的视频的再现数组,并且无论我尝试什么,都会不断成功。

document.getElementById('divMeta.render').innerHTML = v.renditions;

此代码的结果是:

[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

显示有6个单独的演绎。

videos: Array[20] 
0: Object
    FLVFullLength: Object
    FLVURL: "http://brightcove.vo.llnwd.net/pd16/media/1978114949001/1978114949001_2223781677001_Lindy-Fish---Game-Cleaning-Station-Features---Benefits.mp4?pub    
    Id=1978114949001&videoId=2223734749001"
    creationDate: "1363191473140"
    customFields: Object
    economics: "AD_SUPPORTED"
    id: 2223734749001
    lastModifiedDate: "1363200126320"
    length: 45094
    linkText: null
    linkURL: null
    longDescription: null
    name: "Lindy Fish & Game Cleaning Station Features & Benefits"
    playsTotal: 19
    playsTrailingWeek: 19
    publishedDate: "1363191473140"
    referenceId: null
   renditions: Array[6]
       0: Object
       1: Object
          audioOnly: false
         controllerType: "DEFAULT"
         displayName: "Lindy Fish & Game Cleaning Station Features & Benefits.mov"
         encodingRate: 1616956
         frameHeight: 700
         frameWidth: 1248
         id: 2223780276001
         referenceId: null
         remoteStreamName: null
         remoteUrl: null
         size: 9153763
         uploadTimestampMillis: 1363191560801
         url: "http://brightcove.vo.llnwd.net/pd16/media/1978114949001/1978114949001_2223780276001_Lindy-Fish---Game-Cleaning-Station-Features---Benefits.mp4?pub    
         Id=1978114949001&videoId=2223734749001"
         videoCodec: "H264"
         videoContainer: "MP4"
        videoDuration: 45094
        __proto__: Object
    2: Object
    3: Object
    4: Object
    5: Object
    length: 6

正如您在上面我的控制台日志中复制的文本中所看到的那样,在rendition中有6个不同的我想要调用frameWidth = 1248的那个url。

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

你可以循环遍历数组:

var url;
for (var i = 0; i < v.renditions.length; i++) {
    if (v.renditions[i].frameWidth == 1248) {
        url = v.renditions[i].url;
        break;
    }
}