Page 1 of 1

how to do online streaming using SWF files?

Posted: Thu Mar 27, 2008 1:12 pm
by zainy
The code i am currently using for playing FLV files is as follows...


Code: Select all

ContentProviderFromURL ContentProvider =
                                            new ContentProviderFromURL(f_in_box__control1.AxCode, File_Name_Path_URL);
                                    f_in_box__control1.FlashProperty_FlashVars = "autoplay=1&way=http://FLV/FlashVideo.flv";
                                    f_in_box__control1.FlashMethod_SetVariable("FLVPlay", "any_value_here");
                                    f_in_box__control1.PutMovieFromStream(this.GetType().Assembly.GetManifestResourceStream("wclFlashPlayerControl.res.uflvplayer_500x375.swf"));


Can we play swf file using same method? Please provide with the details..

Regards,

Re: how to do online streaming using SWF files?

Posted: Thu Mar 27, 2008 6:47 pm
by Softanics
Thank you for your question.

zainy wrote:Can we play swf file using same method? Please provide with the details..


Do you mean, how to load swf from a stream?

For example:

Code: Select all

Stream stream = f_in_box__control1.PutMovieUsingStream();


After that you can either write the whole movie's content at once:

Code: Select all

stream.Write( ... );
stream.Close();


or create a separate thread and write the data buffer-by-buffer:

Code: Select all

while ( ... )
{
   stream.Write( ... );
}

stream.Close();

Posted: Mon Mar 31, 2008 12:37 pm
by zainy
Thanks for the response,
Can u please send a sample code for this bcause i've tried to do it as per your instructions but its not working.
I want to play the swf file same way as flv file plays in f-in-box control by streaming like i pass the URL to contentproviderfromurl class:
ContentProviderFromURL ContentProvider =
new ContentProviderFromURL(f_in_box__control1.AxCode, FormURL.URL);

Posted: Mon Mar 31, 2008 3:30 pm
by Softanics
Please download it here:
http://f-in-box.com/TEMP/A0A6C127-318F- ... eaming.zip

See this part:

Code: Select all

Stream FromStream = this.GetType().Assembly.GetManifestResourceStream("Sample02_SWF_FLV_Embedding.Embedded_Movies.movie.swf");
Stream ToStream = f_in_box__control1.PutMovieUsingStream();

new FromStreamToStreamWriter(FromStream, ToStream);


Click to "play embedded swf" to see how it works.

Posted: Mon Mar 31, 2008 3:34 pm
by Softanics
BTW if you just need to load a movie from URL, use:

Code: Select all

f_in_box__control1.FlashProperty_Movie = "http://movie.com/...../movie.swf";

Posted: Tue Apr 01, 2008 4:54 am
by zainy
I want to play buffer by buffer. Because of security reasons we cannot download the movie. This method will download movie in temporary files.

Posted: Tue Apr 01, 2008 5:09 am
by Softanics
zainy wrote:I want to play buffer by buffer. Because of security reasons we cannot download the movie. This method will download movie in temporary files.


OK, this example plays a movie buffer by buffer:
http://f-in-box.com/TEMP/A0A6C127-318F- ... eaming.zip

Posted: Tue Apr 01, 2008 5:28 am
by zainy
Man i guess i am not been able to deliver what i want, let me try it again.

I want to play "swf" movie from URL, It should not store on hard drive any way. Also want to play it as it is downloading.

Currently i am downloading swf into stream and on completion, i am playing it.

Thanks for response.

Regards,

Posted: Tue Apr 01, 2008 2:43 pm
by Softanics
zainy wrote:I want to play "swf" movie from URL, It should not store on hard drive any way. Also want to play it as it is downloading.

Currently i am downloading swf into stream and on completion, i am playing it.


So what's the problem?... Create new System.Net.WebRequest, get a stream and start a writer thread, the things are almost the same as in the example:

Code: Select all

using System.Net;

WebRequest request = WebRequest.Create("http://blablabla");

HttpWebResponse response = (HttpWebResponse)request.GetResponse ();

Stream FromStream = response.GetResponseStream();

Stream ToStream = f_in_box__control1.PutMovieUsingStream();

new FromStreamToStreamWriter(FromStream, ToStream);

Posted: Wed Apr 02, 2008 5:40 am
by zainy
Thanks a lot mate, it worked :D