Welcome to Dream.In.Code
Getting Help is Easy!

Join 107,162 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,364 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



XML video playlist not working on the web

 
Reply to this topicStart new topic

XML video playlist not working on the web, Actionscript 2

SecondSight
post 4 Aug, 2008 - 12:51 AM
Post #1


New D.I.C Head

*
Joined: 4 Aug, 2008
Posts: 4

Hello ! smile.gif

I'm a school teacher and I've made a video player which displays guitar video lessons for my pupils. It's made with the Flash video component for flv, AS2 and XML and the videos are published on a Flash media server (streaming server).

I first published the videos on my pupils' web site using html pages + the video component and it's working well.

Then I tried to make a flash video player, but it's not working as expected, and I can't find out why :
- only the first video of the video lists is played and if I try playing another, it freezes the animation.
- if I change which video is played first (if I change the code so that it plays the second or the third video first in a list, for instance), it will play the video. So I believe both the XML files and the video files are ok.
- I checked the data in the combo and saw it's ok too.
- The menus are displaying correctly.

In fact, everything is ok, until I cilck on the listbox to read another video.

So, in the end, I don't know what's wrong... Can someone help me ?

You can see the video player here :
http://guitare.bellepierre.info/flash/
(please note that the videos are not professional videos, it's just for my pupils to work at home).

I publish all the code below. Can someone tell me what is wrong with the listbox's code ?
There's a listener for the listbox and the listener is calling a function to play the video and this is what is not working. If I replace the videoPlay function with something like :
videoPlayer.play(file_url)
it won't work...
If I do the same elsewhere, it works. So I wonder if there is a problem of scope...

But in the videoPlay function, part of the code is executed :

function playVideo(){
videoPlayer.play(videoList_lst.getItemAt(n).data); => this one is not working when I click on the list box (but it does work in other functions). Why ?
videoList_lst.selectedIndex=n;
titre_txt.text=videos[n].attributes.titre; => this one is working !
}



Thank you for your help ! smile.gif

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
CODE
    /*videos_cb is the combobox which displays the video categories.
    videoList_lst is the listbox which displays the list of all the videos.
    videoPlayer is the video component's name.
    titre_txt is a text box displaying the video's title.*/

    stop();

    var videos:Array
    var categorie:String = "musiques.xml";
    videos_cb.selectedIndex=4;
    var vList:XML = new XML();
    vList.ignoreWhite = true;
    var n:Number=0;

    vList.load(categorie);

    vList.onLoad = function(){
       videos = this.firstChild.childNodes;
       for(i=0;i<videos.length;i++){
          videoList_lst.addItem(videos[i].attributes.desc,videos[i].attributes.chemin,videos[i].attributes.titre);
       }
       playVideo();
    }


    function playVideo(){
       videoPlayer.play(videoList_lst.getItemAt(n).data);
       videoList_lst.selectedIndex=n;
       titre_txt.text=videos[n].attributes.titre;
    }

    // COMBOBOX
    var comboListnr:Object = new Object();
    comboListnr.change = function() {
       videoPlayer.stop();
       categorie=videos_cb.value;
       videoList_lst.removeAll();
       vList.load(categorie);
    }
    videos_cb.addEventListener("change",comboListnr);

    // LISTBOX
    var listListnr:Object = new Object();
    listListnr.change = function() {
       videoPlayer.stop();
       n=videoList_lst.selectedIndex;
       playVideo();
    }
    videoList_lst.addEventListener("change",listListnr);


This post has been edited by SecondSight: 4 Aug, 2008 - 01:51 AM
User is offlineProfile CardPM

Go to the top of the page


SecondSight
post 6 Aug, 2008 - 10:52 AM
Post #2


New D.I.C Head

*
Joined: 4 Aug, 2008
Posts: 4

Hello ! smile.gif

I've made a few more tests. I've tested it with a simple button too, using this code :

CODE
testbutton.onRelease=function(){
//playVideo(); [b]=> Using the function = not working[/b]
videoPlayer.play('rtmp://mystreamingsername.org/guitare/noelblanc.flv'); [b]=> Not working too ![/b]
titre_txt.text=videos[n].attributes.titre; [b]=> This one is working[/b]
}


So, it appears that even with a button, I can't have the player reading files...

But :

- the videos are being played at the beginning, when I launch the application, with this code :

CODE

vList.onLoad = function(){
       videos = this.firstChild.childNodes;
       for(i=0;i<videos.length;i++){
          videoList_lst.addItem(videos[i].attributes.desc,videos[i].attributes.chemin,videos[i].attributes.titre);
       }
       playVideo();
    }

function playVideo(){
       videoPlayer.play(videoList_lst.getItemAt(n).data);
       videoList_lst.selectedIndex=n;
       titre_txt.text=videos[n].attributes.titre;
    }


- It also works if I use the playVideo function's code outside of the function. For instance if I write somewhere :
videoPlayer.play('rtmp://mystreamingsername.org/guitare/noelblanc.flv');
It will play the video.

- It also works if I write playVideo(); outide of the other functions.


What can I conclude from that ?


It seems like using a button or the video list component makes it impossible to reach the streaming server.
But using code outside of components and buttons does work.

Can you explain to me how I can solve this problem ?

Thank you ! smile.gif

This post has been edited by SecondSight: 6 Aug, 2008 - 10:55 AM
User is offlineProfile CardPM

Go to the top of the page

bmcc81
post 12 Aug, 2008 - 12:25 PM
Post #3


D.I.C Head

**
Joined: 10 Jul, 2007
Posts: 114


My Contributions


Try checking out

Tutorial - Video XML - Lee Brimlow

Very good Tutorial!!!

Hope it helps
User is offlineProfile CardPM

Go to the top of the page

SecondSight
post 12 Aug, 2008 - 12:42 PM
Post #4


New D.I.C Head

*
Joined: 4 Aug, 2008
Posts: 4

Yes, I know this tutorial, but Lee Brimelow is not using the FLVplayback component.

It seems like this component does not work well with a streaming server when there are many files. I've read on a web site that it looses mapping when there are several files to be played. Or perhaps I simply don't know how to make it work with a streaming server.

Each time I click on the component list to play another video, I get an error message saying that it can't access the server.

Anyway, I managed to make a video player, without using the FLVplayback component. Here it is :
http://guitare.bellepierre.info

It's for my 9 years old pupils, to learn guitar. smile.gif
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 8/27/08 09:25PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month