?
Solved

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

Posted on 2006-11-01
10
Medium Priority
?
450 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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:Mark Gilbert
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
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And 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:
Mark Gilbert earned 1000 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:Mark Gilbert
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
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…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Suggested Courses

752 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