how to generate a playlist from a json file?

753 views
Skip to first unread message

Cristi

unread,
Apr 11, 2011, 2:29:05 PM4/11/11
to jPlayer: HTML5 Audio & Video for jQuery
hello,

i would like to generate a playlist using $.get.JSON:

$.getJSON('http://www.xxx.com/users', function(data) {
$.each(data, function(i,item) {
var audioPlaylist = new Playlist("2", [
//i'm stuck
]);
}):
});

any ideas?? thanks

Cristi

unread,
Apr 11, 2011, 2:41:05 PM4/11/11
to jPlayer: HTML5 Audio & Video for jQuery
maybe use

document.write(name: ''item.fname'',) ??

nick13

unread,
Apr 11, 2011, 9:01:32 PM4/11/11
to jPlayer: HTML5 Audio & Video for jQuery
Hola.

I saw your other post about needing a json playlist, and can hopefully
clear both of your questions up for you. Basically, if you're going to
get an JSON playlist, you can go about it w/ $.ajax() or $.load() or
even $.getJSON(); anyone of those functions works. Personally, I used
$.ajax() because it reads the easiest, and allows for the most
customization.

In your other post, you're trying to play http://sitename.com/index.php?songid=134
or whatever. idk if you can ever get that to work. you want you're PHP
to script to give you the JSON web address of the song. Like
http://sitename.com/song1.mp3.

PHP has a great function called json_encode() that will format your
song name and web urls into json. It was Im using in this project that
does exactly what you're talking bout.

http://www.huement.com/code/ajaxplayer2

Also, if you need a bit more help, I have a blog post at www.huement.com/blog
with more info about using PHP w/ jplayer.

good luck!

Jonathan2

unread,
May 10, 2011, 9:27:54 AM5/10/11
to jPlayer: HTML5 Audio & Video for jQuery
Talking of which, I don't know if this is of any use to anyone, but
here's a very, very simply way of converting feedburner xml (and hence
podcasts) to JSON:
http://blog.marcqualie.com/2011/03/xml-to-json-using-google-feed-api.html

Here's a demo he uses:
http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&q=http://feeds.feedburner.com/marcqualie

I can imagine this would be a good basis for someone more skilled than
me looking to make an easy xml>json playlist bridge for jplayer..

On Apr 12, 2:01 am, nick13 <nickthirt...@gmail.com> wrote:
> Hola.
>
> I saw your other post about needing a json playlist, and can hopefully
> clear both of your questions up for you. Basically, if you're going to
> get an JSON playlist, you can go about it w/ $.ajax() or $.load() or
> even $.getJSON(); anyone of those functions works. Personally, I used
> $.ajax() because it reads the easiest, and allows for the most
> customization.
>
> In your other post, you're trying to playhttp://sitename.com/index.php?songid=134
> or whatever. idk if you can ever get that to work. you want you're PHP
> to script to give you the JSON web address of the song. Likehttp://sitename.com/song1.mp3.
Reply all
Reply to author
Forward
0 new messages