Video player plugin for Flash Panorama Player

ia_video plays linear media files (.flv and .swf) under XML control in FPP. Its main use is for playing transition movies between pans. Contributed by FPP forum user Rick Workman. Version 1.0, free.

This plugin has three assignable attributes (see your FPP documentation for more info on "Assignments and motion tweens"). The below:
[name]=[value],[time],[type] [onDone],[onInterrupt]
Becomes something like:
onClick="external.ia_video.url=Movies/Pan1ToPan2.flv,1000,fade,loadPan2,loadPan2"

url="path/to/media/file"       
Causes media file to be loaded and playing commenced.
*
visible="0" or visible="1"     
If 0, causes movie to be stopped and removed from display.
if 1, causes movie to be redisplayed and started.
*
interactive="0" or interactive="1"
If 0, mouse clicks and keyboard have no effect on movie.
if 1, mouse click or spacebar cause pause/resume, double click stops movie.

Currently, the only tween supported is "fade" with a positive time value. Any fades will use current pano qualityMotion setting; restored to qualityStatic when fade is completed
On completion, onDone is executed; on interruption (see mouse behaviour below), onInterrupt is executed.

Other notes:
1. Any fades will use current pano qualityMotion setting; restored to qualityStatic when fade is completed.
2. Fades are done at 12 fps. (This may eventually get parameterized.)
3. The default value of interactive is 1; i.e., the user can pause or terminate the video.
4. This plugin is loaded like any other; i.e., via a layer parameter assignment. Make sure its layer number is high enough to make it visible when playing.

Two mouse interactions are implemented:
Mouse click cause the movie to pause if playing, and resume if paused.
Mouse double click interrupts the movie (and executes interruptFunctionName).
*
Example of usage in a panorama xml file for Pan 1 to play a transition movie :
Pan1 xml:

         <panorama>
                <parameters>
                        layer_10 = plugins/ia_video.swf
                </parameters>
                <hotspots>
                        <global>
                                <box id="goToPan2" url="images/BlueWireFrame.png" align="B"
                                        pan="180" tilt="1" orientation="sphere" rotationX="0" rotationY="0"
                                        onClick="external.ia_video.url=Movies/Pan1ToPan2.flv,1000,fade,loadPan2,loadPan2"
                                        loadPan2="loadPano(xml_file=Pans/Pan2.xml,0,none)"
                                />
                        </global>
                </hotspots>
         </panorama>

Pan2 xml:

       
<panorama>
                <parameters>
layer_10 = plugins/ia_video.swf
                </parameters>
                <hotspots>
                        <global
                                onTransitionEnd="external.ia_video.visible=0,1000,fade"
                        >
                        </global>
                </hotspots>
         </panorama>

So this example has a single hotspot "goToPan2". When clicked, a transition movie ("Pan1ToPan2.flv" in the "Movies" folder) is played with an initial fade in of 1 second.
When the movie has finished (or is interrupted), "loadPan2" is executed which loads the destination pan ("Pan2.xml" in folder "Pans"). Note that at this point the end (or interrupted point) of the movie is still visible.
When the new pan is loaded, FPP executes the global onTransitionEnd, which then fades the movie away (again 1 sec.) revealing the newly loaded pan.

Please leave comments or questions below!

DOWNLOAD (includes ia_ambientmix Ambient sound mixer/player Plugin)

Rick: So the transition

Rick:

So the transition movie plays, and then the next panorama is loaded? Is it possible for the movie to play while the next panorama is loading, for a smoother transition between (ie, less wait)?

If not, then maybe using this in conjunction with Zephyr's Cache plugin would be interesting...

Yes, this can be done

Yes, this can be done (loading pan in parallel with playing transition movie), but the scripting gets tricky. Rather than serializing two asynchronous activities, they're executing in parallel. And I see no obvious way of sycnhcronizing the completion, i.e., how do you know when both activities have ended, if that matters. So whether this is effective may depend on timing issues.

Other issues:
1. If you fade the movie in in concert with loading, you may see the new pan momentarily before the movie becomes completely opaque. This can probably be solved by introducing a timer after starting the movie to delay initiating the load.
2. You have to be careful where completion functions are placed. The original pan's hotspots typically are unloaded, so they shouldn't go there. Only other place is in the globals, so you just have to make sure they aren't overwritten by the new pan.

Bottom line is I've tried this and it seems to work, but it's a bit tricky to script properly. (Typical of asynchronous programming.)

That's not to say that Zephyr's Cache plugin wouldn't also be useful in this context; it probably would ensure that the new pan is ready before the transition ends or is stopped. And it may circumvent the tricky nature of the problem since you could revert back to doing things in sequence.

Rick

February 22, 2008: Updated

February 22, 2008: Updated to v1.0a (expanded documentation)

Rick, This looks quite

Rick,

This looks quite useful. Are there any examples of its use floating around?

As for the parallel loading issue I may have a solution: Pass the URL(s) for the new pano to iaVideo. Once the video starts playing make a URLRequest for the new pano so it loads into cache. Don't execute the done function until both the transition and URL loading complete. When loadPano executes it will find the new pano already in cache.

Does that make sense?

Scott

Scott, Well obviously I've

Scott,

Well obviously I've started to use it some, but since I'm primarily focused on offline usage, I don't have a Web example to point you at. To tell you the truth, one of the reasons I posted it was to get some reaction from Web oriented designers.

The main context for this kind of plugin is where you want something more than a simple cross fade between pans, i.e., there's a travel element as you move from place (pan) to place (another pan), that can be captured in linear media (video footage, slideshow, ..). To tell you the truth, I haven't seen very many examples of such interactive movies (pans and complex transitions) on or off the Web.

I think I understand your suggestion (correct me if I'm wrong) and it certainly could be done. By cache, I assume you mean the browser's cache, so it only applies to online applications. In essence, it's a combination of the current plugin and a subset of Zephyr's cache plugin. And the reason for the combination is solely to support calling the doneFunction when both functions (playing video and loading URL) are complete.

I'll think about this some more; it would be nice to have a cache mechanism that also works in the offline case, which, I think, means it really needs to be supported at the FPP level (or below). On the other hand, it may not be much of an advantage for the offline case, so just making it optional is good enough.

Rick

For interested folks, here

For interested folks, here are a couple places using neat transitions -- one is QuickTime based and the other is a homegrown Flash player. Not sure if the QT one will even work anymore.

http://travel.supertour.com/miamibeach.aspx

http://www.virtualwhistler.com/

Rick, Sorry for the tardy

Rick,

Sorry for the tardy reply. I thought I would get automatic notification when someone a replied to me.

For offline use there would probably be little advantage to browser caching. One exception would be to avoid any delay in reading from the CD (assuming that is how this is being distributed) vs the HD such as browser cache. In any case it is nothing like the advantage online viewers might see.

Can't say if my suggestion uses Zephyr's pre-caching technique since I don't think his code is revealed anywhere.

The benefit, for online viewers at least, isn't just coordination of the done function. Rather it gives loading the next pano a head start so there is less or no waiting between the end of the transition and loading the next pano.

Since this may be of little benefit to you, if you wanted to share your code others could possibly extend it with a pre-caching algorithm and share that here.

I plan to shoot something that could be used to test this kind of transition in the next week so who knows. Maybe I will be able to get an online example up in a few weeks.

Scott

Hi Scott, Well I think

Hi Scott,

Well I think anybody can write a plugin, independent of this video plugin, which loads a url. Then the browser will find it in its cache when the loadpano function is called. It can even provide notification via a doneFunction call when the url has loaded. Am I missing something?

And, as far as I can tell, you can do this using Zephyr's plugin as is. The only drawback is that pre-loading can only be done when the pan containing the parameters is initially loaded, i.e., you can't decide later on the basis of some user action, to preload, e.g., the next set of pan images. (This might be a useful addition to the cache plugin.)

Now, if playing the movie and url loading are proceeding in parallel, i.e., head start, the trick is to know when both operations are complete, which is why a "combo" plugin is needed, unless someone can think of a clever way to write XML to achieve this. (Maybe by assignment to global functions which get modified by doneFunctions?)

So this is why I think the only benefit to adding it to this plugin is doneFunction synchronization, and this could certainly be done. But it seems like poor design; why should a video player have anything to do with browser caching? A better, and more general, solution, in my view, is dynamic caching (i.e., not just at pano load time) plus a synchronization mechanism (a separate plugin) for asynchronous activites (any tween assignment with a time value).

Comments?

Rick

The transition stucks at the

The transition stucks at the last frame of the video .
I think
onTransitionEnd="external.ia_video.visible=0,1000,fade"
did not work well to close the video .

I tried to re-write code to only one XML file :

Quang's question has a

Quang's question has a fairly lengthy thread in the FPP forums:
http://flashpanoramas.com/forum/showthread.php?t=1361

ia_ambient question

Hi!

The ia_ambient topic seems to be closed, thats's why I write here.
I'm trying to move around on a panorama (see steps first..sixth) and use this plugin to play sound during this lookaround. But if I add any item in the block,
it will NOT bring me to panoramas/test.xml. If it is empty, the transition works properly.
External.loadpano.loadxml is nothing more than a function in a very simple plugin made by me to load an xml file.
Any idea? (I think that resources might be in use by ia_ambient and that's why I cannot go to the next panorama).

music=media/mysong.mp3

re: ia_ambient question

let me answer my question Smile

put the following lines in the second.xml if you have a transition from first.xml to this second.xml

onStart="external.ia_ambientmix.mix=;"
onTransitionEnd="external.ia_ambientmix.mix=music:1,1000; pano.pan=-37.8467422896368,2000,smooth; "

the clear performed at onStart is required!!

Hi, Not sure exactly what

Hi,

Not sure exactly what the problem is, or why the fix is required, but I haven't had to clear the mix in the onStart handler for any of the tests I've done. (In fact, I normally don't use the onStart handler.)

If you want to post (or send me) any more details on the XML so I can generate a test case, I'll look into this further.

Rick

fullscreen mode

Hi,

Is there a way to play the video at the exact Fit and not in fullscreen mode ?

thanks

Matt

Re: fullscreen mode

This plugin was designed to fit the movie to the panorama player area, so I think the answer to your question is no.

However, I have been working on a successor to ia_video which has considerably more flexibility - position, scale, alignment, etc. In fact it has many of the useful attributes of static hotspots. So the "API" as seen from XML is quite different than ia_video.

I have a beta version in limited distribution. If you're interested in helping me test, send me a private email.

Rick
ridgeworks@mac.com

How do i stop this video from playing...

and return to the panorama?

scenario: the company who has hired me needs a before and after kitchen remodeling shot thrown in as a hotspot. since an animated gif would look terrible, i decided to make a .swf file of the 2 pictures on a loop cross-fading between each other. i now face 2 problems -

1) using ia_video i cannot set the size of the swf file that is playing. unfortunately it takes up the whole pano screen.

2) i cant click on the swf while it is playing to cancel it and return to the panorama.

anyone have a good solution (or a better way of doing it)? i got the swf to show up using this code (for some reason it wont let me put in the < and /> portion of the code on this message but you guys know its at the beginning and end lol):

box id="arrowcam1"
url="images/arrowcam.png"
linked="images/1"
cacheAsBitmap="0"
pan="-141"
tilt="-4"
distance="1.5"
depth="1"
rotation="30"
alt="Kitchen"
altFont="Arial"
altSize="18"
altColor="0x000000"
altFill="0xFFFFFF"
altStroke="0x990000"
altAlpha="1"
altXOffset="26"
altYOffset="-12"
onClick="external.ia_video.url=images/Kitchen.swf"

how can i turn it off? can someone help me with the rest of the necessary code?

(ideally i would like it to play the video IN the pano in a 699x500 box. i have emailed the dev of the plugin as he has a beta in the works that supposedly allows for resizing but...)

"ia_video" was initially

"ia_video" was initially design to support transition videos between pans, so you're hitting some of the limitations that I (and other)s have discovered, i.e., size and position isn't flexible. That's what the reworked plugin (now in beta) is meant to address.

You should be able to terminate the video by double clicking (single click does pause/resume).

However, if you have a looping video within a single pan, you should be able to to just use hotspots as currently implement using assignment to the hotspots "url" attribute. I'm pretty sure there are examples of this on the FPP blog that Denis maintains on the Flashpanoramas website. Note that attaching video to hotspots gives you a lot of flexibility on size and position as well as the option of actually embedding video in the pan. What it doesn't do is provide notification of when the video is done (necessary for transitions among other things), but that isn't important as long as the video is a loop which must be interactively terminated.

"Video player" and "Ambient sound player/audio mixer" plugins

Hello Rick and others,
can you tell us when your Video player "flexible" will be ready?
And can you tell me what is the différence between your "Ambient sound player/audio mixer" and the "mp3hotspot.swf" from Denis Chumakov? what is possible with yours that isn't possible with denis one?
i don't see différences but my poor english understanding let me think i'm wrong...
Thank's in advance
Clio

Re:"Video player" and "Ambient sound player/audio mixer" plugins

I've pretty much finished with the new video plugin but have been waiting for any feedback from a few beta testers I've enlisted before committing to wider distribution. I can send you some preliminary documentation (text file) if you're interested in details.

The ambient sound plugin I've written supports dynamic mixing of multiple "sound tracks". This was a capability I used in an earlier project using QuickTime and I wanted to reproduce the same functionality. That project used a number of ambient sounds (wind, traffic, crowds, etc.) that I wanted to mix in different proportions as I moved from pan to pan with cross fading from one mix to another.

Denis has made two plugins available: a standard plugin (mp3player.swf) which plays from a single source and allows you set the volume from xml. It also contains an interactive volume control, which you may or may not want. (I wanted a separate volume control which affected all sound sources.)

His second plugin is a "smart hotspot" (mp3hotspot.swf) which associates a sound source with a hotspot. This allows you to have multiple sound sources in a pan, supports directional sound, etc. I guess it would be possible to define multiple non-directional sound hotspots linked to all pans that could be used to achieve the same effect as the ambient sound plugin (by varying the soundVolume attributes as you move). I think this is somewhat complicated for my purposes, but it may work better for you.

Rick

thank you for your answer

thank you for your answer Rick,
yes i'm interested in your preliminary documentation
bye

Clio, If you send me an

Clio,

If you send me an email (ridgeworks@mac.com) , I'll email you back a copy.

Rick

video not load, please HELP

Hi,

I try to use your plugin without sucess...

I try this:

- a small preview pano load
- then an FLV video plays on with the preview on the background
- when the video finish, the main pano loads and de video is unloaded

These are some parts os the xml code... I use the flash 10 version on pano.swf...

please help...

layer_10 = files/plugins/ia_video.swf

LocalConnectionID="lc_test"
onStart="loadPreviewUno();

"

loadPreviewUno ="

loadPano(?panoName=files/visualFiles/imagi_1_sm/imagi_1&zoomHome=0.49&panHome=-92&tiltHome=0, 200, fade);

onTransitionEnd= playvideo();

"

playvideo ="
external.ia_video.url = files/media/videos/video.flv,1000,fade, loadMainuno, loadMainuno;

"

loadMainuno = "
loadPano(?panoName=files/visualFiles/imagi_1/imagi_1&zoomHome=0.49&panHome=-92&tiltHome=0, 200, fade);
onTransitionEnd=lanzar_presentacion();

"

Sorry for the delay in

Sorry for the delay in responding; I was out of town for a couple of weeks.

There's nothing obviously wrong with your XML code. The usual problem with a movie failing to play at all is that the movie can't be found. When using a relative path (as you are) for Flash video files (suffix .flv), the start of the path appears to be the directory containing the pano.swf file, so that's one thing to check.

If that isn't the problem, I'll need more information to help troubleshoot, e.g., debug trace or a complete non-working example.

Rick

Question about update

Rick Workman wrote:

This plugin was designed to fit the movie to the panorama player area, so I think the answer to your question is no.

However, I have been working on a successor to ia_video which has considerably more flexibility - position, scale, alignment, etc. In fact it has many of the useful attributes of static hotspots. So the "API" as seen from XML is quite different than ia_video.

I have a beta version in limited distribution. If you're interested in helping me test, send me a private email.

Rick
ridgeworks@mac.com

Hi,
thanks for sharing this great plugin, I've just use it for the first time, and it is very useful.
I have a question about plugin update, is it available somewhere? I'm just waiting for new functions - generally setting size/scale of video transition.
Myksa

Re: Question about update

Thanks for your interest.

I've finished development on the new plugin but I'm waiting for feedback from a couple of "beta" testers who have an early copy. I think the new plugin should do what you want (all the useful attributes of static hotspots) , but if you're interested in early documentation (plain text), send me an email and I'll forward you a copy.

Rick