Intergrate Jplayer with Wordpress -
i want make playlist made of files added wordpress custom meta box. jplayer generates list using javascript, there way bypass , use regular html?
edit:
or guidance on how call wp function playlist? getting ideas call-php-function-from-jquery, not sure how create multiple items/tracks or loop through them in jquery script?
new jplayerplaylist({ jplayer: "#jquery_jplayer_2", cssselectorancestor: "#jp_container_2" }, [ { title:"1", mp3:"url/file", oga:"url/file" }, { title:"2", mp3:"url/file", oga:"url/file" }, ], { swfpath: "js", supplied: "oga, mp3", wmode: "window", smoothplaybar: true, keyenabled: true });
update:
i echoing post_mime_types '$alltracks' jquery script this:
<?php $query_audio_args = array( 'post_type' => 'attachment', 'post_mime_type' =>'application/ogg', ); $audio_attachments = get_posts($query_audio_args); foreach ( $audio_attachments $audio_attachment ) { $ogg = wp_get_attachment_url( $audio_attachment->id ); $tracks[] = '{ title:"'.$audio_attachment->post_title.'", oga:"'.$ogg.'", }'; $alltracks = implode(',',$tracks); } ?> $(document).ready(function() { new jplayerplaylist({ jplayer: "#jquery_jplayer_2", cssselectorancestor: "#jp_container_2" }, [ <?php echo $alltracks; ?> ], { swfpath: "js", supplied: "oga, mp3,aif", wmode: "window", smoothplaybar: true, keyenabled: true }); });
Comments
Post a Comment