Reputation: 485
I only want to capture the values of "duration" and "start", so in the example below it would be 288 and 0 respectively.
How do I do this in the this loop?
onPlaylist: function(event){
var arrayTime = jwplayer("container").getPlaylist();
var key;
for (key in arrayTime){
if (!arrayTime.hasOwnProperty(key)){
continue;
}
console.log(JSON.stringify(arrayTime[key]));
}
Here are the console.log results:
{"provider":"video","file":"videos/Set1_mid.flv","image":"thumbs/set1_mid.jpg","description":"5 minute cardio with hand weights", "author":"","duration":288,"title":"04:48","date":"","link":"","type":"video","start":0, "mediaid":"","streamer":"","levels":[{"width":0,"bitrate":0,"url":"videos/Set1_mid.flv"}],"tags":"","index":0}
Your help is appreciated.
Upvotes: 0
Views: 3698
Reputation: 943510
Create a new object with just the data you want.
var item = arrayTime[key];
console.log(JSON.stringify({ duration: item.duration, start: item.start }));
Upvotes: 2