Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Supporting Technologies > Flash Media Server

Reply
 
Thread Tools Rate Thread Display Modes
Old 12-17-2003, 03:36 AM   #1
Billy T
Oops I did it again
 
Billy T's Avatar
 
Join Date: Oct 2001
Location: Melbourne
Posts: 8,579
Default play 2 flvs through netstream

hey all

trying to play a couple of external flvs through 1 netstream object (ie one finishes, the next plays)

this works fine

ActionScript Code:
// Create a NetConnection object: var netConn2:NetConnection = new NetConnection(); // Create a local streaming connection: netConn2.connect(null); // Create a NetStream object and define an onStatus() function: var netStream2:NetStream = new NetStream(netConn2); netStream2.onStatus = function(infoObject) {   status2.text += "Status (NetStream2)" + newline;   status2.text += "Level: "+infoObject.level + newline;   status2.text += "Code: "+infoObject.code + newline;   if(infoObject.code=="NetStream.Play.Stop"){ trace('yep');   } }; // Attach the NetStream video feed to the Video object: my_video2.attachVideo(netStream2); // Set the buffer time: netStream2.setBufferTime(25); // Being playing the FLV file: netStream2.play("ed356k6.flv");

the trace happens and everybody is happy. But if I try to make it play the next vid with
ActionScript Code:
if(infoObject.code=="NetStream.Play.Stop"){           netStream2.close();       my_video2.clear(); netStream2.play("ed156k.flv");   }

it continually crashes flash, crashes my browser etc...

what am I doing wrong?

Thanks
__________________
Billy
Online Galleries
iPhone Safety App - iStaySafe
Free Flash Video Tutorials
Photo Website Template

Don't email or PM me questions...
Billy T is offline   Reply With Quote
Old 12-17-2003, 03:43 AM   #2
Billy T
Oops I did it again
 
Billy T's Avatar
 
Join Date: Oct 2001
Location: Melbourne
Posts: 8,579
Default

btw if I place a button comp on the stage and add this code

ActionScript Code:
clippyListener = new Object(); clippyListener.click = function (evt){ netStream2.play("ed156k.flv"); } but1.addEventListener("click", clippyListener)

and click this halfway through the first vid, it jumps to the second vid without any problems...
__________________
Billy
Online Galleries
iPhone Safety App - iStaySafe
Free Flash Video Tutorials
Photo Website Template

Don't email or PM me questions...
Billy T is offline   Reply With Quote
Old 12-17-2003, 03:53 AM   #3
Mortimer Jazz
Thing
 
Mortimer Jazz's Avatar
 
Join Date: Jun 2001
Location: UK
Posts: 2,418
Default

Does it work if you do
ActionScript Code:
if(infoObject.code=="NetStream.Play.Stop"){        netStream2.play("ed156k.flv"); }
?
Mortimer Jazz is offline   Reply With Quote
Old 12-17-2003, 03:55 AM   #4
Billy T
Oops I did it again
 
Billy T's Avatar
 
Join Date: Oct 2001
Location: Melbourne
Posts: 8,579
Default

nope that was the first thing I tried
Billy T is offline   Reply With Quote
Old 12-17-2003, 04:04 AM   #5
Mortimer Jazz
Thing
 
Mortimer Jazz's Avatar
 
Join Date: Jun 2001
Location: UK
Posts: 2,418
Default

I was thinking you may need to clear the video before you clear the stream but I guess not.
Maybe when the first stream finishes (without you interupting it) the object tries to re-initialise itself and there's a lag in doing so?

Try using a setInterval to repeatedly grab at the next video stream at second intervals
Mortimer Jazz is offline   Reply With Quote
Old 12-17-2003, 04:19 AM   #6
Billy T
Oops I did it again
 
Billy T's Avatar
 
Join Date: Oct 2001
Location: Melbourne
Posts: 8,579
Default

nice one mort

this
ActionScript Code:
if (infoObject.code == "NetStream.Play.Stop") {         myInt=setInterval(loadNext,1000);     }

plus this

ActionScript Code:
function loadNext() {     clearInterval(myInt);     netStream2.play("ed156k.flv"); }

work a treat...

Thanks mate!!
Billy T is offline   Reply With Quote
Old 12-17-2003, 07:17 AM   #7
Mortimer Jazz
Thing
 
Mortimer Jazz's Avatar
 
Join Date: Jun 2001
Location: UK
Posts: 2,418
Default

Mortimer Jazz is offline   Reply With Quote
Old 05-14-2004, 09:44 AM   #8
chrisgannon
Registered User
 
Join Date: May 2004
Posts: 14
Default

I tell you what - this thread/solution has saved my life/hair - I couldn't find anyone else with this problem and as usual MM are as useless as ever - cheers Mortimer and Billy T
chrisgannon is offline   Reply With Quote
Old 05-14-2004, 12:01 PM   #9
Mortimer Jazz
Thing
 
Mortimer Jazz's Avatar
 
Join Date: Jun 2001
Location: UK
Posts: 2,418
Default

:]
For the benefit of anyone searching threads for netStream related stuff there is now a tutorial here
http://www.nwebb.co.uk/nw_htmlsite/i...al=flv2&part=1
(soon to be on actionscript.org)
__________________
............................
FLEX/FLASH BLOG
Previous Flash Tutorials

............................
Mortimer Jazz is offline   Reply With Quote
Old 05-14-2004, 01:23 PM   #10
mpol777
Registered User
 
mpol777's Avatar
 
Join Date: Jun 2001
Posts: 247
Default

Just a note. As far as I have found it is not possible to play 2 stream simultaneously with the standard use of the netConnection/netStream Objects. I know this isn't what the BillyT was trying to do, but for people like me that are that search and find this thread... good luck.
mpol777 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:14 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.