Click here to Skip to main content
11,492,523 members (58,981 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Javascript
I'm working on a video player that pulls from an xml playlist. So far I have it success fully pulling from the following xml structure:

course chapter - looping object title (video title) screen (video location and type) description (description of video) /chapter /course

Here is what I would like to do, but am having difficulty understanding how to set it up properly:

course courseinfo label=" " chapter label =" " screen label = " " (instead of title) path= " " (url to file) type="video/mp4" /screen /chapter /courseinfo /course

here is the code that I am using:

 // properties
var XML_PATH = "xml/screens.xml"; var videos_array=new Array();
 
// init the application function init() { // call loadXML function loadXML(); }

// XML loading function loadXML() { $.ajax({ type: "GET", url: XML_PATH, dataType: "xml", success: function onXMLloaded(xml) {

// loop for each item $(xml).find('chapter').each(function loopingItems(value) { // create an object var obj={title:$(this).find("title").text(), screen:$(this).find("screen").text(),

description:$(this).find("description").text()}; videos_array.push(obj);
 
// append

and video title $("#playlist2").append('
'); $("#playlist2").append(''+obj.title+''); });
// close

$("#playlist2").append('
'); // append video tag player $("#player").append(' src="'+videos_array[0].screen+'" type="video/mp4" />Your browser does not support the 
video tag.'); // append description $("#description").append(videos_array[0].description);
// call addListeners function addListeners(); } }); }
 
// add
 
listener function addListeners() { // loop for each list item $('#playlist2 li').each(function looping(index) { // onclick... $(this).click(function onItemClick() { // empty playlist and description $("#player").empty(); $("#description").empty(); // append video tag $("#player").append(' src="'+videos_array[index].screen+'" type="video/mp4" />Your browser does not support 
the video tag.'); // append description $("#description").append(videos_array[index].description); }); }); }
Also, I want to display the course info lable in a box called #courseinfo. The player is set up with the video element on top, then I've been trying to put in the courseinfo under that, then the description, then the actual playlist.

any help would be much appreciated
Posted 20-Nov-12 5:26am
Comments
Sergey Alexandrovich Kryukov at 20-Nov-12 13:53pm
   
Question? Where?
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 399
1 Maciej Los 266
2 KarstenK 210
3 CPallini 208
4 Sascha Lefèvre 195
0 Sergey Alexandrovich Kryukov 9,943
1 OriginalGriff 8,610
2 Sascha Lefèvre 3,609
3 Maciej Los 3,372
4 Richard Deeming 2,440


Advertise | Privacy | Mobile
Web02 | 2.8.150520.1 | Last Updated 20 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100