2013-04-03 50 views
0

我通過Brightcove公司我的影片引渡陣列試圖循環,並保持上來不成功不管我怎麼努力。視頻譯叢環陣列

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

此代碼的結果是:

[對象的對象],[對象的對象],[對象的對象],[對象的對象],[對象的對象],[對象的對象]

顯示有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 

正如你可以從我的控制檯日誌上面複製的文本可見,演繹裏邊有6分不同的人,我想打電話給一個網址的frameWidth = 1248

任何建議?

回答

0

您只需通過數組循環:

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

太好了,謝謝你這麼多,可以完美運行! – user2000613