FPCM_PUT_MOVIE and VPCM_PUTMOVIEFROMMEMORY with FLV

DLL Edition of the F-IN-BOX
zenkick
Posts: 6
Joined: Tue Sep 11, 2007 11:23 pm

FPCM_PUT_MOVIE and VPCM_PUTMOVIEFROMMEMORY with FLV

Postby zenkick » Wed Sep 19, 2007 3:53 pm

We are encountering issues when loading (via memory) an FLV into a running SWF.

If we use FPCM_PUT_MOVIE, it works.

If we use FPCM_PUT_MOVIE_FROM_MEMORY, it doesn't.

Simple use case:

1.) Create new flash project (we are using CS3)
2.) Import Video.
3.) Choose FLV (this is what we're using http://tinyurl.com/ytpmuj)
4.) Tell it to "Stream from Server"
5.) Choose "No Skin" to make it simpler
6.) Finish and "Test Movie"

Now, run that SWF wrapped in FiB.

When it calls for tada.flv, it will work only from a file but not a memory stream.

Can you advise?

BTW, we are utilizing FLV w/ADPCM for audio encoding to avoid licensing costs from MP3-- that's why the FLV in question has no video.

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Re: FPCM_PUT_MOVIE and VPCM_PUTMOVIEFROMMEMORY with FLV

Postby Softanics » Wed Sep 19, 2007 5:45 pm

Thank you for your question.

zenkick wrote:When it calls for tada.flv, it will work only from a file but not a memory stream.

Can you advise?


So you load tada.flv, i.e. using a relative path, not full. Am I right?
Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html

zenkick
Posts: 6
Joined: Tue Sep 11, 2007 11:23 pm

Re: FPCM_PUT_MOVIE and VPCM_PUTMOVIEFROMMEMORY with FLV

Postby zenkick » Wed Sep 19, 2007 6:32 pm

Softanics wrote:So you load tada.flv, i.e. using a relative path, not full. Am I right?


That's the tricky part. tada.flv is loaded "from" tada.swf. Only tada.flv is passed to f-in-box, and tada.swf is loaded through Flash calls. Internally within Flash, tada.flv is set within the CS3 project through Import Video -> Choose FLV. The wrapper also uses a skin, SkinOverPlaySeekMute.swf (although the same results also happen without the skin).

There are two ways we've tried to load the container tada.swf, each with calling SendMessage. Both ways register a callback function with FPC_AddOnLoadExternalResourceHandler, OnLoadExternal(). We have loaded external .png files from within Flash, and that all works. The issue happens when we try to load that .flv from within Flash.

The basic flow we are looking for is (broken up for readability):

1. The user supplies a filename (tada.swf)

2. The application loads that file into memory, and passes it to f-in-box

3. f-in-box sends the binary data to Flash, which starts the movie playback

4. During playback, the movie tries to load an external file (tada.flv)

5. f-in-box intercepts the attempt to load a file from Flash, and forwards it to the application (this is the unusual step).

6. The application loads this new asset into memory, and passes it back


The two ways we are trying to do this are with the FPCM_PUT_MOVIE and FPCM_PUTMOVIEFROMMEMORY messages. Both of these work when the external file is a .png or a .swf. What happens with the .flv is different:

With FPCM_PUT_MOVIE: In step #5, the registered callback is called for the skin ("SkinOverPlaySeekMute.swf"), but there is no intercept delivered for the external asset ("tada.flv"), and no WM_NOTIFY messages are sent. However, Flash still loads the file directly from disk, and plays back properly.

The only problem with this method is that we need to play from memory. Otherwise everything else is the same.

With FPCM_PUTMOVIEFROMMEMORY: In step #5, two WM_NOTIFY messages are sent, but the callback is not called at all. The first is FPCN_LOADEXTERNALRESOURCE, which is handled, but then FPCN_LOADEXTERNALRESOURCEEX is sent. That message is ignored. In both cases, only the skin is intercepted ("SkinOverPlaySeekMute.swf"), but the skin does not even play. This time, though, the external asset ("tada.flv") does not load at all, from disk or otherwise, and does not play back at all.

This second method has worked every time up until now. The only change we have made is that the content .swf files are now being created with Flash 9 (CS3), rather than Flash 8.

Any suggestions would be very gratefully welcomed.

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Re: FPCM_PUT_MOVIE and VPCM_PUTMOVIEFROMMEMORY with FLV

Postby Softanics » Wed Sep 19, 2007 8:08 pm

Thank you very much for such good description!

zenkick wrote:4. During playback, the movie tries to load an external
file (tada.flv)


This is a key moment. If you load, for example, "1.jpg", the handler is called. But not in the case when flash tries to load a FLV file using relative path like "tada.flv" or "dir/folder/1.flv". It's related with internals of the flash player, so we can change it. But there are two workarounds:

1. You load not "tada.flv", but "http://FLV/tada.flv". Such full URLs are handled by a handler (see Sample1 and 2 of the demo package that demonstrate how to load flv from the memory or a stream).

2. You load a movie using path like "http://PRIVATE/main.swf". You handle this URL and provide content of the movie. When flash tries to load "tada.flv", you receive "http://PRIVATE/tada.flv" in the handler. Now you are able to provide content of the FLV.
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

nystrom.anthony
Posts: 1
Joined: Sat Nov 24, 2007 3:40 am

Need help locating a flv file for research

Postby nystrom.anthony » Sat Nov 24, 2007 3:42 am

I am trying to locate an flv video file with the following audio properties.

soundType:mono

soundSize 16 bit

soundRate 11 kHz

soundFormat ADPCM

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Re: Need help locating a flv file for research

Postby Softanics » Sat Nov 24, 2007 11:39 am

nystrom.anthony wrote:I am trying to locate an flv video file with the following audio properties.

soundType:mono

soundSize 16 bit

soundRate 11 kHz

soundFormat ADPCM


Just to create such FLV file? Have you tried http://flvdev.com/flv_encoder_sdk/ ?
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html


Return to “DLL Edition”

Who is online

Users browsing this forum: No registered users and 19 guests