Author Message

Posted: Fri Nov 20, 2009 6:01 pm   Post subject: Keeping multiple presentations (browsers) in sync in Flex

I'm building a Flash Media Server/Flex application in which I'm trying to synchronize slide presentations in multiple browser clients. This requires that I be able to click a "next" button in one browser, and set the precise presentation position in a second browser programmatically (not with buttons).

The sample3 project in the AS3 connector Flex examples has a "setPresentationPosition()" function that appears to have the right name, but isn't getting me there. Here's what I'm doing:

1. Click the "next" button in browser1 (this makes a call to m_playbackController.gotoNextStep()). OK here.

2. Push the current presentation position [getPresentationPosition()] up to the Flash Media Server. This position gets pushed to browser2. OK here.

3. Browser2 calls setPresentationPosition() with the position it receives from FMS. Not OK here.

Something in step 3 there doesn't work. The slide in browser2 does change but doesn't stay quite in sync with browser1. It lags about one slide behind and sometimes doesn't change at all.

Best I can guess is that "gotoNextStep()" takes you to one position but "setPresentaionPosition()" doesn't work the same way.

Is there a more reliable way to do this?


Profile profile test

Posted: Fri Nov 20, 2009 11:57 pm   Post subject: Re: Keeping multiple presentations (browsers) in sync in Flex

Doing a bit more studying of this situation.

I can't get the second browser (presentation) in sync with the first because the PlaybackController properties don't appear to get updated after the call to gotoNextStep(). A number of properties just remain unchanged when they should be advancing.

Essentially I can't tell the second presentation what position to go to because the first presentation is telling me the wrong answer when I ask it where it is. It's telling me it's on the previous slide or step when I can see in the UI that it has moved to a new one. Basically a stale data problem.

Here's an onBtnNextClick() method that logs properties "before" and "after" the call to gotoNextStep() followed by some output I got when I ran it:

Code:
private function onBtnNextClick(e:FlexEvent):void
{
   if (m_playbackController)
   {
      //Check PlaybackController properties before advancing to next step
      trace("getPresentationPosition (before): " + getPresentationPosition());
      trace("currentSlideIndex (before): " + m_playbackController.currentSlideIndex);
      trace("currentVisibleSlideIndex (before): " + m_playbackController.currentVisibleSlideIndex);                                                                                                         
      trace("currentSlidePlaybackPosition (before): " + m_playbackController.currentSlidePlaybackPosition);
      trace("currentStepIndex (before): " + m_playbackController.currentStepIndex);
      trace("currentSlideDuration (before): " + m_playbackController.currentSlideDuration);
      
      //Advance to next step
      m_playbackController.gotoNextStep();
      
      //Check PlaybackController properties again
      trace("getPresentationPosition (after): " + getPresentationPosition());
      trace("currentSlideIndex (after): " + m_playbackController.currentSlideIndex);   
      trace("currentVisibleSlideIndex (after): " + m_playbackController.currentVisibleSlideIndex);                                                                                                                                                                                 
      trace("currentSlidePlaybackPosition (after): " + m_playbackController.currentSlidePlaybackPosition);
      trace("currentStepIndex (after): " + m_playbackController.currentStepIndex);
      trace("currentSlideDuration (after): " + m_playbackController.currentSlideDuration);                              
   }
}


Here's the output:

currentSlideIndex (before): 0
currentVisibleSlideIndex (before): 0
currentSlidePlaybackPosition (before): 1
currentStepIndex (before): 0
currentSlideDuration (before): 1.001

call gotoNextStep:

getPresentationPosition (after): 1.001
currentSlideIndex (after): 0
currentVisibleSlideIndex (after): 0
currentSlidePlaybackPosition (after): 1
currentStepIndex (after): 0
currentSlideDuration (after): 1.001

What can I do to get around this?


Profile profile test

Posted: Mon Nov 23, 2009 12:39 pm   Post subject: Re: Keeping multiple presentations (browsers) in sync in Flex

The communication between Flex application and iSpring generated presentation is implemented via LocalConnection technology. Such communication is asynchronous which means that there is no guarantee that the command is executed immediately. You may add an event listener which will receive a notification when a particular event (position change) occurs.

Could you please send an example which illustrates the problem to our support team?


Profile profile test WWW www ICQ ICQ

Posted: Mon Nov 23, 2009 6:32 pm   Post subject: Re: Keeping multiple presentations (browsers) in sync in Flex

Aleksey Malov wrote:
The communication between Flex application and iSpring generated presentation is implemented via LocalConnection technology. Such communication is asynchronous which means that there is no guarantee that the command is executed immediately. You may add an event listener which will receive a notification when a particular event (position change) occurs.

Could you please send an example which illustrates the problem to our support team?


Done. Sent compile ready example and instructions.

Can you keep me abreast of the progress? It's a high priority item for my team. It would seem to be the final hurdle to purchase for us.

Thank you.


Profile profile test

Posted: Wed Nov 25, 2009 5:49 pm   Post subject: Re: Keeping multiple presentations (browsers) in sync in Flex

Has anyone looked at this? Support forum says I should hear something within 24 hours. Nothing yet.


Profile profile test

Posted: Thu Nov 26, 2009 12:51 pm   Post subject: Re: Keeping multiple presentations (browsers) in sync in Flex

The problem will be investigated in next few days. The development team is working on their current tasks in their development plan.

As I wrote you earlier the communication is asynchronous and the playback state of the API is updated upon receiving a callback notification from the presentation. Please consider this fact when designing your application.

Our development team will determine whether the problem is in our code or not.

In case the problem is caused by the improper use of ActionScript API (see my comment above) the problem research is a subject for consulting services.


Profile profile test WWW www ICQ ICQ

Posted: Fri Nov 27, 2009 6:43 am   Post subject: Re: Keeping multiple presentations (browsers) in sync in Flex

Aleksey Malov wrote:
The problem will be investigated in next few days. The development team is working on their current tasks in their development plan.

As I wrote you earlier the communication is asynchronous and the playback state of the API is updated upon receiving a callback notification from the presentation. Please consider this fact when designing your application.

Our development team will determine whether the problem is in our code or not.

In case the problem is caused by the improper use of ActionScript API (see my comment above) the problem research is a subject for consulting services.



Consulting services? Cool. How much should I charge you for working to make your software better? I'll come up with a rate. Don't worry, I'll cut you a break ;)

And please note that the support page says to expect a response within 24 hours of submission. Doesn't mean you have to solve it by then but some sort of response would be helpful. I think the work I'm doing will broaden the appeal of your software. FMS is pretty popular these days.

Based on your comment about the asynchronous nature of the communication between the AS3 and AS2 layers, I've revised my code and resubmitted it to support. Please disregard the first submission and code and focus on the revision.

I took your advice and put my code that tells the other browsers about the updated state of the first browser in an onAnimationStepChanged() event handler function. I think this is what you had in mind. The new state of the presentation (after hitting the next or prev buttons) should be available there.

I send this new presentation state information to other browsers through FMS and have code in them to programmatically synchronize their views based on it. You'll note that browser 1 and browser 2 still don't stay in sync and I'm not sure why. It seems as though browser 1 handles navigating transition steps well and sends the right current state data to browser 2. Browser 2 seems to receive this data fine. I just can't find the tools to "programmatically" make browser 2 play like browser 1.

Thanks for looking into this. Please let me know what you find.


Profile profile test

Posted: Mon Nov 30, 2009 9:45 am   Post subject: Re: Keeping multiple presentations (browsers) in sync in Flex

Dear redxtripod,

Our developer has examined the files you provided. Here the answer from him:

The following events may be used for presentation synchronization:
1. SlidePlaybackEvent.CURRENT_SLIDE_INDEX_CHANGED
2. StepPlaybackEvent.ANIMATION_STEP_CHANGED
3. PlaybackPositionEvent.SLIDE_POSITION_CHANGED

As far as we see from your code the shared object is updated only when the following event occurs:
ANIMATION_STEP_CHANGED
This event occurs only when animation step is changed (moving to another slide also triggers this event). It is obvious that the event doesn't occur during slide seeking within the same animation step.

According to the documentation:

Quote:
Slide animation timeline consists of one or more animation steps. Animation step is a sequence of animation effects playing without mouse click requirement.

Slide background, static shapes, and shapes animated before the first mouse driven animation are playing at the animation step 0. So there is at least 1 animation step in each slide.

Each mouse-driven animation and the subsequent non mouse-driven animations are playing at the separate animation step. In other words, the number of animation steps is equal to number of on-click animations plus 1.


So your code performs synchronization only when animation step is changed. It does not perform synchronization when user changes slide position seeking the time line.

To fix the problem you need to update shared object when the user stops dragging the position slider.

Quote:
Consulting services? Cool. How much should I charge you for working to make your software better? I'll come up with a rate. Don't worry, I'll cut you a break ;)


The problem you reported is not a fault in our product.
In case you do need our consulting services to simplify the development of your application you may contact our sales department at sales [at] ispringsolutions [/dot] com


Profile profile test WWW www ICQ ICQ

Posted: Mon Nov 30, 2009 4:24 pm   Post subject: Re: Keeping multiple presentations (browsers) in sync in Flex

Quote:
So your code performs synchronization only when animation step is changed. It does not perform synchronization when user changes slide position seeking the time line.

To fix the problem you need to update shared object when the user stops dragging the position slider.


Again, thanks much for looking into this, but this is incorrect. The user is not dragging the slider. He is hitting the "next" and "prev" buttons. The second presentation goes out of sync when the "next" and "prev" buttons are hit. If your developer actually runs my example he or she will see this occur. The slider does not come into play in this scenario. In fact, we do not plan to have a slider in our application. We will have only "next" and "prev" buttons.

Running my code in a debugger one can see that the current state of presentation 1 after clicking the "next" button does make its way properly to presentation 2. Using this information to programmatically set this presentation to say, slide index 4, currentSlidePlaybackPosition 0 does not reliably set the presentation to that position though. Sometimes it sets it to slide index 4, currentSlidePlaybackPosition 0.0004997501249375313. Slider events will not correct this situation.

According to the documentation, the only event available to me to grab accurate current presentation state information, if the presentation has animations, is the ANIMATION_STEP_CHANGED event. CURRENT_SLIDE_INDEX_CHANGED will not fire if the slide index has not changed on user button clicks.

Quote:
The problem you reported is not a fault in our product.
In case you do need our consulting services to simplify the development of your application you may contact our sales department at sales [at] ispringsolutions [/dot] com


At this point, the problem does appear to be the fault of the product. The three events:

1. SlidePlaybackEvent.CURRENT_SLIDE_INDEX_CHANGED
2. StepPlaybackEvent.ANIMATION_STEP_CHANGED
3. PlaybackPositionEvent.SLIDE_POSITION_CHANGED

do not provide sufficient hooks to "programmatically" play a slide presentation in a manner equivalent to navigating with buttons (manually calling "m_playbackController.gotoNextStep()" and "m_playbackController.gotoPreviousStep()" when buttons are clicked). There are no examples of this in the samples that come with the SDK. There are examples showing button and slider navigation, but none showing "programmatic" navigation, so I assume this has not been considered a common or anticipated use of the product. I would think that this would be one of the primary benefits of an SDK so working examples showing this should be a part of the kit.

My company's product will need to be able to reproduce button navigation precisely via programmatic control. It may be possible but as of now we've not seen that it is and nobody has demonstrated to us that it is. I'm relatively sure the company would not want to pay extra money for this. I'm sure they'd feel this should be part of the core functionality of the product and that the price of the software should cover it.

We have been in contact with sales and they have quoted a price for the product to us. All that's left to do is to write the check. We'd like to do that, but we can't until we know it can be used successfully in the manner we need.

If I find a way to make it work I'll move the process forward, but as of now I'm stalled.


Profile profile test

Posted: Wed Dec 02, 2009 4:33 pm   Post subject: Re: Keeping multiple presentations (browsers) in sync in Flex

Replace the following code in ispring_browser2.mxml syncPresPosition() method)

Code:
                playbackController.gotoSlide(index, false);
                playbackController.seek(playBackPos);
                if(forward)
                {
                    playbackController.endSeek(autoStart);                     
                }
 

with the following one:
Code:
 if (playbackController.currentSlideIndex != index)
                {
                    playbackController.gotoSlide(index, false);
                }
                 
                if (forward)
                {
                    playbackController.playFromStep(stepIndex);
                }
                else
                {
                    playbackController.pauseAtStepEnd(stepIndex);
                }


Profile profile test WWW www ICQ ICQ

Posted: Fri Feb 12, 2010 11:10 pm   Post subject: Re: Keeping multiple presentations (browsers) in sync in Flex

Been awhile since I looked at this.

The revised code above helped a little with moving forward. But reverse still does not work. If you go to the end of the presentation in browser 1 and start working your way backwards, browser 2 does not stay in sync. And sometimes it takes two clicks to move back a step rather than one.

I sent the revised source code view links to support.

Once again, all that stands in the way of us writing that check is getting this programmatic navigation working properly.


Profile profile test

Posted: Fri Feb 19, 2010 12:48 pm   Post subject: Re: Keeping multiple presentations (browsers) in sync in Flex

the answer was sent to you by e-mail


Profile profile test WWW www ICQ ICQ

Posted: Mon Sep 17, 2012 4:45 am   Post subject: Re: Keeping multiple presentations (browsers) in sync in Flex

Hi rexdtripod,

Could you tell me how to implement the second step you did?
2. Push the current presentation position [getPresentationPosition()] up to the Flash Media Server. This position gets pushed to browser2. OK here.
I need to do same thing and we have a FMS server active, but we simply don´t know how to make the presentation works on FMS.

Thanks a lot
Ota


Profile profile test
Display posts from previous:  Sort by  

  


Who is online
Who is online In total there are 6 users online :: 1 registered, 0 hidden and 5 guests (based on users active over the past 5 minutes)
Most users ever online was 108 on Thu Nov 21, 2013 3:41 pm

Registered users: Bing [Bot]