Solved

How can I play two flv video files one after another in one swf file?

Posted on 2006-11-01
10
444 Views
Last Modified: 2008-01-09
I want to be able to play multiple flv files in one swf file, but not at the same time.  It will be as basic as having one play until it is finished then having a new one play.

Check out a http://www.neave.tv/ for a good example of this.

I've tried changing ns.play to a new address when the duration of the video almost reaches its end.  The function executes, but it seems like the 2nd video (http://www.vectorsector.net/fullScreen/flv/testB.flv) loads over and over again.

Does anyone know a good and easy way of doing this?  I'm figuring it will have to do something with first unloading the current video and reestablishing the NetStream.

Here's my current actionscript code:

[code]
var nc:NetConnection = new NetConnection();
nc.connect(null);

var ns:NetStream = new NetStream(nc);

theVideo.attachVideo(ns);

ns.play("http://www.vectorsector.net/fullScreen/flv/testA.flv");

rewindButton.onRelease = function(){
ns.seek(0);
}
playButton.onRelease = function(){
ns.pause();
}

var videoInterval = setInterval(videoStatus,100);
var amountLoaded:Number;
var duration:Number;

ns["onMetaData"] = function(obj){
duration = obj.duration;
}


function videoStatus(){
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
loader.loadBar._width = amountLoaded * 216;
loader.scrub._x = ns.time / duration * 216;
}

var scrubInterval;

loader.scrub.onPress = function(){
clearInterval(videoInterval);
scrubInterval = setInterval(scrubit,10);
this.startDrag(false,0,this._y,216,this._y);
}

loader.scrub.onRelease = loader.scrub.onReleaseOutside = function(){
clearInterval(scrubInterval);
videoInterval = setInterval(videoStatus,100);
this.stopDrag();
}

function scrubIt(){
ns.seek(Math.floor((loader.scrub._x / 216) * duration));
}
[/code]

And..just in case, I don't think it's real important but here's my current player: http://www.vectorsector.net/fullScreen/vidTest3.swf]vidTest3.swf

Right now the player doesn't feature a working scrubber, and don't mind the current graphics...its all for test purposes right now.

Thanks.
0
Comment
Question by:bostoncybertech
  • 3
  • 3
10 Comments
 
LVL 2

Expert Comment

by:tyruz
ID: 17865191
why don't you try to add the two movies together in one file, say with Movie Maker, and then import it as 1 flv?
0
 

Author Comment

by:bostoncybertech
ID: 17872078
This is why: this will soon be a video player that will play videos that users upload.  The uploaded videos will be converted to flv.  Users may be able to choose the movie they want to play.  This is why they have to be separate flv's.  Part of this will also have the ability to play the next video when one is finished.  I figured out an alternative and I thank you for your help.
0
 
LVL 18

Expert Comment

by:ingwa
ID: 17878516
Greetings, Although I'm not good at ActionScript, I have had a video player created in the past for a client of ours.  Basically what the actionscripter did was develop a video player in flash which read from an xml file.  the xml was really simple and contained information like Title, Link to the fla, and a description.  Perhaps on these lines you could look into developing your video player a bit further.
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

Author Comment

by:bostoncybertech
ID: 17883747
Thanks.  Recently I've successfully sent a variable from a text file to pearl to flash.  This is where I think I want to go, but for some reason I have unable to send a web address (the flv) as the variable.  I'm confident I'll get this figured out soon enough.  The hardest thing will be editing the php file upload system so it sends a variable (a flv link) to pearl to write to the text file in a list fashion.  Flash then will have to know how to go down the list or tell pearl to go down the list.  I can probably just assign it to add a number to pearl every time it finishes a video in flash.  So, peal will look at the script and say, oh okay we went from 2 to 3.  What's 3 on the list?  This link: foo.flv.  Send foo.flv to flash as a variable of a web address to play the next movie.
0
 
LVL 18

Accepted Solution

by:
ingwa earned 250 total points
ID: 17884164
Why would you use perl and php together?  PHP can do everything perl can do and more.  What I had done with the player we had been given was use mysql to store the data.  I personally used tinymce and the filemanager plugin that is available for tinymce ($50) which enabled me to upload and manage files, as well as select them and have the path inserted into a text field.  From there it was a simple matter of inserting a new record into the database when entering information using our own bespoke CMS.  Once the insert was completed, I did a simple query on the database, and for each row found with a link, insert it into an xml file, starting from the beginning of the file, and then close it off.  This xml file was called by flash to do the rest of the actionscript stuff.  

Regarding the list, flash would actually read this using actionscript and the values in an xml file.  Then there's no more interaction with the server, other than streaming the media files through.  

I find it rather cumbersome if you are going to be dealing with 3 different technologies when you could use 2.  Perhaps an expert could assist you in modifying the perl script into php so that you gain a performance, customability, and ease of updating if you post another question in the PHP ta.

Hope this helps.
0
 

Author Comment

by:bostoncybertech
ID: 17884920
Yes great point.  If I could use just PHP instead of PHP and Perl it would be a lot less cumbersome.  I have to also look at my options with the list it keeps either will xml or txt and see what the advantages of the two.  Thanks
0
 
LVL 18

Expert Comment

by:ingwa
ID: 18035259
bostoncybertech, is there any further assistance that we could provide you with?

Pinaldave, just to let you know that I am interested in the final disposition of this question.  But it would be better to resolve the situation in it's entirety.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you work with shopping cart / ecommerce relates web sites, you need to pass the certain form post details to the payment gateway process page with required details for the products items you give to order. Also you may need to track the ordered…
There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question