How can i display button on start of a video??

0 votes
asked Jul 11, 2017 by suresh2291 (170 points)
Hi All,
I want to display button inside the layout,but the button should visible when video start to play.
Before the video is not yet to start button should not visible...
Please Guys help me to solve this problem..

1 Answer

0 votes
answered Jul 11, 2017 by kenn (18,750 points)
If you are using EasyAR SDK 2.0, reference the sample code for isRenderTextureAvailable, display button when it returns true.

For older versions, display button when the player callback gives a Ready event.
commented Jul 12, 2017 by suresh2291 (170 points)
Hi Kenn,
I have declared the button inside MainActivity Class  which is an Activity Class and isRenderTextureAvailable is available in ARVideo class which is normal class.How can use this object in MainActivity.Since i cannot use button inside Class.

My Objective is to display button when video start and perform onClick event after the button display.


I cannot perform these events inside the class.

Please can you let me know through sample code snippet....

Thank You.
commented Jul 12, 2017 by suresh2291 (170 points)
edited Jul 12, 2017 by suresh2291
This is my layout xml
 <FrameLayout
        android:id="@+id/glsurface"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <ImageButton
            android:id="@+id/sharepage"
            android:layout_width="50dp"
            android:layout_height="60dp"
            android:layout_gravity="right"
            android:background="@drawable/share"
            android:visibility="invisible"/>

        <ImageButton
            android:id="@+id/review"
            android:layout_width="50dp"
            android:layout_height="60dp"
            android:layout_gravity="left"
            android:background="@drawable/message"
            />

        <ImageButton
            android:id="@+id/productinfo"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_gravity="bottom"
            android:background="@drawable/producinfo"/>
    </FrameLayout>

I need to use the declared ImageButton inside Activity class(MianActivity.java).

I have done this way
declared Image Button and ARvideo class object inside MainActivity
 public ImageButton share,review,productInfo;

public ARVideo video = new ARVideo();

Inside OnCreate Method i have initialise  button
share = (ImageButton) findViewById(R.id.sharepage);


@Override
            public void onSuccess()
            {
                //int status = 0;
                share = (ImageButton) findViewById(R.id.sharepage);
                ((ViewGroup) findViewById(R.id.preview)).addView(glView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
                video.DisplayButton(share);
                Log.i("isRenderTexture", String.valueOf(video.isRenderTextureAvailable()));
                if(video.isRenderTextureAvailable() == true)
                {
                    share.setVisibility(View.VISIBLE);
                }
            }
commented Jul 21, 2017 by kenn (18,750 points)
It is not a problem of how to use EasyAR, but how to build your app. There are many ways to do this, for example, you can rewrite the sample in your favorite way, or just send a message to the main activity.
I'm not an expert of Android app development, sorry not giving you any specific code for solution.
Welcome to EasyAR SDK Q&A, where you can ask questions and receive answers from other members of the community.
...