Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 19th, 2012, 01:45 PM
ansipants ansipants is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 1 ansipants User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 32 m 56 sec
Reputation Power: 0
Talking Homework - Java/XML help

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:

<code>
// properties
var XML_PATH = "xml/screens.xml";
var video_width;
var video_height;
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)
{
// set video_width and video_height
video_width=$(xml).find("course").attr("width");
video_height=$(xml).find("course").attr("height");

// 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 <ul> and video title
$("#playlist2").append('<ul>');
$("#playlist2").append('<a><li id="chapter"><strong>'+obj.title+'</strong></li></a>');
});

// close </ul>
$("#playlist2").append('</ul>');
// append video tag player
$("#player").append('<video width="600" height="300" controls="controls"><source src="'+videos_array[0].screen+'" type="video/mp4" />Your browser does not support the video tag.</video>');
// append description
$("#description").append(videos_array[0].description);

// call addListeners function
addListeners();
}
});
}

// add <li> listener
function addListeners()
{
// loop for each list item
$('#playlist2 li').each(function looping(index)
{
// onclick...
$(this).click(function onItemClick()
{
// empty left column and description
$("#player").empty();
$("#description").empty();
// append video tag
$("#player").append('<video width="600" height="300" controls="controls"><source src="'+videos_array[index].screen+'" type="video/mp4" />Your browser does not support the video tag.</video>');
// append description
$("#description").append(videos_array[index].description);
});
});
}
</code>
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

Reply With Quote
  #2  
Old November 19th, 2012, 06:59 PM
NormR's Avatar
NormR NormR is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Aug 2010
Location: SW Missouri
Posts: 2,956 NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 2 h 56 m 11 sec
Reputation Power: 345
Try a javascript forum. This one is for java

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > Homework - Java/XML help

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap