Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 03-10-2008, 11:34 PM   #1
pelachrum
mighty mouse
 
Join Date: Oct 2002
Location: New York City
Posts: 290
Default streaming media into flash

i'm trying to stream a movie right into the flash movie (using the media component I'm guessing?)

can I do it right through actionscript?
pelachrum is offline   Reply With Quote
Old 03-11-2008, 12:50 AM   #2
inhan
it's all about patience
 
inhan's Avatar
 
Join Date: Jun 2005
Location: istanbul
Posts: 6,696
Default

Yes, but you need to have that component in your library.
__________________
Ali Inhan
Turkish graphic and web designer
an Apple fan
www.aliinhan.com
inhan is offline   Reply With Quote
Old 03-11-2008, 01:02 AM   #3
pelachrum
mighty mouse
 
Join Date: Oct 2002
Location: New York City
Posts: 290
Default

...actually correction, based on some digging around I see that I don't want the controls visible... I don't know much about this nook of Flash... here's what i have
ActionScript Code:
import mx.video.*; this.attachMovie("FLVPlayback", "my_FLVPlybk", 1000, {width:345, height:296, x:100, y:100}); my_FLVPlybk.contentPath = "testFile.flv";

...few things, i'm guessing the 1000 is the length of the video it will buffer before it plays, right?
also, even though width:345, height:296 are the dimensions of my flv file, the video is smaller when i test it and playing with those numbers has no effect on the size...
pelachrum is offline   Reply With Quote
Old 03-11-2008, 03:25 AM   #4
inhan
it's all about patience
 
inhan's Avatar
 
Join Date: Jun 2005
Location: istanbul
Posts: 6,696
Default

1000 is the depth and every other value is what you think it is.
The reason of that problem/issue is, the default for a FLVPlayback instance is autoSize=true. And it is recommended to set the size after attaching it. Check the example:

ActionScript Code:
import mx.video.FLVPlayback; var flv:FLVPlayback = this.attachMovie("FLVPlayback", "my_flv", 100); flv.setSize(400, 200); flv.autoSize = false; //flv.maintainAspectRatio = false; // comment and uncomment the previous line to see the difference. flv.contentPath = "video1.flv"; var listener:Object = new Object(); listener.ready = function(evtObj:Object) {     trace("width:"+evtObj.target.width+", height:"+evtObj.target.height); }; flv.addEventListener("ready", listener);
__________________
Ali Inhan
Turkish graphic and web designer
an Apple fan
www.aliinhan.com
inhan is offline   Reply With Quote
Old 03-11-2008, 06:26 AM   #5
dannyhouk
Flash Pilgrim's Progress
 
dannyhouk's Avatar
 
Join Date: Aug 2007
Location: IL, USA
Posts: 130
Default

Quote:
Originally Posted by pelachrum View Post
...actually correction, based on some digging around I see that I don't want the controls visible... I don't know much about this nook of Flash... here's what i have
You're basically using actionscript to build your flv playback component, whereas you could as Inhan suggested just drag the FLVPlayback component onto the stage, give it an instance name, and then use actionscript to control how you use it. Whether the flv has its own buttons or not depends on how you published your flv. For the playback controls you can select "none" when publishing in which case the flv you call will not have its own controls, only what you select from the components library.
dannyhouk is offline   Reply With Quote
Old 03-11-2008, 02:04 PM   #6
pelachrum
mighty mouse
 
Join Date: Oct 2002
Location: New York City
Posts: 290
Default

yeah that explain everything, thanks guys
how do I loop this movie to start from the beginning when it's done?
pelachrum is offline   Reply With Quote
Old 03-11-2008, 06:30 PM   #7
inhan
it's all about patience
 
inhan's Avatar
 
Join Date: Jun 2005
Location: istanbul
Posts: 6,696
Default

A correction to Danny is, I'm not creating an instance on the stage. I'm just keeping a FLVPlayback instance in the library. The reason you use attachMovie rather than createClassObject is the fact that the FLVPlayback class extends the MovieClip class.

Additionally, to make it loop, use the 'complete' event handler:

ActionScript Code:
var listener:Object = new Object(); listener.complete = function(evtObj:Object) {     evtObj.target.play(); }; flv.addEventListener("complete", listener);
__________________
Ali Inhan
Turkish graphic and web designer
an Apple fan
www.aliinhan.com

Last edited by inhan; 03-11-2008 at 07:34 PM.
inhan is offline   Reply With Quote
Old 03-11-2008, 06:41 PM   #8
pelachrum
mighty mouse
 
Join Date: Oct 2002
Location: New York City
Posts: 290
Default

thanks Inhan, works like a charm
pelachrum is offline   Reply With Quote
Old 03-11-2008, 07:35 PM   #9
inhan
it's all about patience
 
inhan's Avatar
 
Join Date: Jun 2005
Location: istanbul
Posts: 6,696
Default

You're welcome. You might need to check the documentation for aditional features.

Cheers.
__________________
Ali Inhan
Turkish graphic and web designer
an Apple fan
www.aliinhan.com
inhan is offline   Reply With Quote
Old 03-12-2008, 05:29 PM   #10
pelachrum
mighty mouse
 
Join Date: Oct 2002
Location: New York City
Posts: 290
Default

do you know by any chance if there is a way to dictate how much of this media file is streamed before it is played? I'm getting pretty decent performance but it does get a bit choppy in the beginning... I'm wondering if I could delay the play a tad or buffer somehow?

Last edited by pelachrum; 03-12-2008 at 05:33 PM.
pelachrum 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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Save "Shareobject" data in a server without Flash Media Server. Urtzo ActionScript 2.0 4 05-15-2007 12:18 PM
Streaming Video in Flash MX 2004 "NOT PROFESIONAL" Col. Ostomy Other Flash General Questions 0 11-29-2004 11:41 PM
Streaming Flash Player 6 simail Other Flash General Questions 7 04-03-2002 11:14 AM
Flash MX seminar Tink ActionScript 1.0 (and below) 5 03-17-2002 04:41 AM
Php, Javascript, and Flash 5 browser detect and more! Redline01 Server-Side Scripting 2 08-11-2001 01:09 AM


All times are GMT. The time now is 11:53 AM.

///
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.