[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2006-11-01
10
Medium Priority
?
452 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
7 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

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…
I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

834 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