Jess
Jess

Reputation: 3146

How can I overlay a "play button" over a VR Video?

I want to add a giant white play button on top of the video for both VR and non-VR modes of my VrVideoView. How do I tell when I'm in VR view?

I'm using com.google.vr.sdk.widgets.video.VrVideoView to handle playing the video both with and without the headset on.


My thought process so far:

Upvotes: 1

Views: 1345

Answers (2)

thiagooo0
thiagooo0

Reputation: 1

Maybe you can extend the VrVideoView and dismiss the button in the create methods, like this:

public EHVideoPlayerPano(Context context, AttributeSet attributeSet) 
{
    super(context, attributeSet);
    FrameLayout frameLayout = (FrameLayout) getChildAt(0);
    for (int i = 0; i < frameLayout.getChildCount(); i++) 
    {
        Object view = frameLayout.getChildAt(i);
        if (view instanceof RelativeLayout) 
        {
            //hide the botton
            ((RelativeLayout) view).setVisibility(GONE);
        }
    }
}

Upvotes: 0

Jess
Jess

Reputation: 3146

We ended up having the video edited to add a play button to the first frame.

It's not possible to be notified of when the user enters/exits VR mode.

Here's why: The Android Google Cardboard VR SDK is built to be accessible for easy integration in content-viewing apps. It is not built to be used in a custom-VR video viewing application. Here's a thread on Github about the topic

Due to the limitations above, we very quickly rewrote the application in Unity (still using Cardboard SDK)

Upvotes: 2

Related Questions