所以 .getsounds 返回一个对象列表,这些对象是音乐播放列表中的曲目,每个曲目都有一个歌曲“标题”元素字段,我想访问并在屏幕上打印。如何遍历对象的索引 (0-25) 并列出它们的标题元素?
widget.getSounds(function(sound) {
console.log(sound);
});
来自控制台的 json 示例:
[Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object]
0: Object
_playlist: Object
_resource_id: 79970721
_resource_type: "sound"
artwork_url: "https://i1.sndcdn.com/artworks-000041122143-1fb8rz-large.jpg?54f228e"
attachments_uri: "https://api.soundcloud.com/tracks/79970721/attachments"
bpm: null
comment_count: 14
commentable: true
created_at: "2013/02/19 20:58:48 +0000"
description: "Trademark's Over The Top Mix x Frat Music
↵
↵Check out the full playlist at fratmusic.com
↵
↵Tracklist:
↵
↵"Easy (Kids At The Bar Remix)" Mat Zo And Porter Robinson
↵
"Brainfreeze (Original Mix)" Lazy Rich
↵"I Could Be The One (Audrio Remix)" Nicky Romero And Avicii
↵
"Get Wild (Original Mix)" Candyland
↵
"Surge (Feat. Wynter Gordon) [Original Mix]" Clockwork
↵
"Stellar (Extended Club Mix)" Daddy's Groove
↵"So Young So High (Anybody Remix)" Dada Life
↵
"Killin' It (I.Y.F.F.E Remix)" Krewella
↵"Rewind (Mikkas Remix)" Emma Hewitt
↵"Get Lucky (Extended Mix)" Trademark
↵"Taito (Original Mix)" Mord Fustang
↵
"Buck" LOUDPVCK And D!RTY AUD!O
↵"Bootleg Fireworks (The Rebirth)" Dillon Francis
↵
"Incredible (Original Mix)" Carnage And Borgore
↵
"April (Original Mix)" Syn Cole
↵"Weapon (Vicetone Remix)" Cazzette
↵
"Head Up (Original Mix)" Arno Cost
↵"Pressure (Original Mix)" John Dahlback
↵
"Joyenergizer (Original Mix)" Sander Van Doorn
↵
"Ah Yeah (TJR Edit)" Will Sparks
↵
"Wakanda (Original Mix)" Dimitri Vegas And Like Mike
↵
"No One Knows Who We Are (Feat. Lights) [Original Mix]" Kaskade And Swanky Tunes
↵"Years (Hard Rock Sofa Remix)" Alesso
↵
↵www.deejaytrademark.com
↵www.facebook.com/deejaytrademark
↵
www.youtube.com/deejaytrademark
↵www.twitter.com/deejaytrademark"
download_count: 0
downloadable: false
duration: 2551173
embeddable_by: "all"
favoritings_count: 180
genre: "Mix"
id: 79970721
isrc: ""
key_signature: ""
kind: "track"
label_id: null
label_name: ""
license: "cc-by"
likes_count: 180
original_content_size: 102777753
original_format: "mp3"
permalink: "trademarks-over-the-top-mix"
permalink_url: "http://soundcloud.com/deejaytrademark/trademarks-over-the-top-mix/"
playback_count: 4838
purchase_title: "Free Download"
purchase_url: "https://www.facebook.com/deejaytrademark/app_192602997444667"
release: ""
release_day: 19
release_month: 2
release_year: 2013
reposts_count: 35
sharing: "public"
state: "finished"
stream_url: "https://api.soundcloud.com/tracks/79970721/stream?secret_token="
streamable: true
tag_list: "DJ Trademark Dee Jay Over The Top Frat Music Continuous Free Download"
title: "Trademark's Over The Top Mix (Frat Music Exclusive)"
track_type: "remix"
uri: "https://api.soundcloud.com/tracks/79970721?secret_token="
user: Object
user_id: 780957
video_url: null
waveform_url: "https://w1.sndcdn.com/B4JdNrZ8Eyz5_m.png"