Solved

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

Posted on 2006-11-01
10
443 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now