Kidoz: Audio from video in expanded slider continues after hiding slider programmatically

Issue: Sound playback continues when exit scene

 

To reproduce: 

  1. Expand slider

  2. Switch to a video ad

  3. Exit scene without manually closing slider, but programmatically calling ads.hide( “panelView” )

@Per

May I ask how it’s possible for a user to exit a scene while still watching a video?

Sure. It is in the expanded slider

https://www.dropbox.com/s/0yokihabi8agyeq/2016-07-04%2011.59.44.png?dl=0

Aha, I see.

There’s an experimental feature that I’d like you to try. The following will collapse the panelView programmatically:

ads.hide( “panelView” , {close=true})

The audio should stop after this call.

If you want to hide the handle after the panelView has collapsed, you can then call ads.hide( “panelView” )

Since the collapse of the panelView is animated, I think the best location to hide the handle would be in the “closed” event for the panelView.

Keep in mind you’d need to keep track of the state of your scene so that the handle is only hidden if the user is exiting the scene. Otherwise every “closed” event would hide the handle, which isn’t what you’d want :slight_smile:

Thanks for quick response. Without having tested it, I can imagine an animated collapse might cause issues if I switch scenes before the animation is completed? 

The animated collapse is provided by the Kidoz SDK, and unfortunately can’t be avoided.

If you run into problems, you could try calling ads.hide( “panelView”, {close=true} ) to collapse the panelView (and stop the audio), and then use a timer.performWithDelay() to call  ads.hide(“panelView”) to hide the handle.

If you need to keep track of if the panelView is open or not when you exit the scene, you can use the event listener and look for “displayed” and “closed” events for the panelView.

Thanks for the advice, looks like it is working ok with the experimental approach

@Per

May I ask how it’s possible for a user to exit a scene while still watching a video?

Sure. It is in the expanded slider

https://www.dropbox.com/s/0yokihabi8agyeq/2016-07-04%2011.59.44.png?dl=0

Aha, I see.

There’s an experimental feature that I’d like you to try. The following will collapse the panelView programmatically:

ads.hide( “panelView” , {close=true})

The audio should stop after this call.

If you want to hide the handle after the panelView has collapsed, you can then call ads.hide( “panelView” )

Since the collapse of the panelView is animated, I think the best location to hide the handle would be in the “closed” event for the panelView.

Keep in mind you’d need to keep track of the state of your scene so that the handle is only hidden if the user is exiting the scene. Otherwise every “closed” event would hide the handle, which isn’t what you’d want :slight_smile:

Thanks for quick response. Without having tested it, I can imagine an animated collapse might cause issues if I switch scenes before the animation is completed? 

The animated collapse is provided by the Kidoz SDK, and unfortunately can’t be avoided.

If you run into problems, you could try calling ads.hide( “panelView”, {close=true} ) to collapse the panelView (and stop the audio), and then use a timer.performWithDelay() to call  ads.hide(“panelView”) to hide the handle.

If you need to keep track of if the panelView is open or not when you exit the scene, you can use the event listener and look for “displayed” and “closed” events for the panelView.

Thanks for the advice, looks like it is working ok with the experimental approach