Skip to content

Ads: Support moving playback from one view/activity to another #9075

@Miklesam

Description

@Miklesam

Hello, I am trying to find an example using a rather trivial case of screen rotation when playing an ad. But in the examples, the manifest contains:

android parameter: configChanges = "orientation", so when rotate, views does not recreating.

In my case, without android parameter: configChanges = "orientation". When I rotate the screen, I lose information about the advertisement.

not_work.mp4

To solve the problem, I save playerView and add it to container when views recreate.
But this method looks pretty crutch:
(viewModel.playerView?.parent as ViewGroup).removeView(viewModel.playerView)
findViewById(R.id.container).addView(viewModel.playerView)

Looks like that:

work.mp4

Here's a repository with an example described
https://github.com/Miklesam/IMA-SDK-Rotate

Please help me find the correct method when rotating the screen.

Thanks for all your help.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions