Solved

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

Posted on 2006-11-01
10
442 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

757 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

21 Experts available now in Live!

Get 1:1 Help Now