Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VideoView is not working in window. #28

Open
ankur99999 opened this issue Jan 7, 2015 · 1 comment
Open

VideoView is not working in window. #28

ankur99999 opened this issue Jan 7, 2015 · 1 comment

Comments

@ankur99999
Copy link

I modified your StandOutExampleActivity to show VideoView in frame, I also modify my XML but VideoView is not showing in frame.

Here is the modified files.

StandOutExampleActivity

    package wei.mark.example;

    import wei.mark.standout.StandOutWindow;
    import android.app.Activity;
    import android.os.Bundle;
    import android.widget.MediaController;
    import android.widget.VideoView;

    public class StandOutExampleActivity extends Activity {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);

            StandOutWindow.closeAll(this, SimpleWindow.class);  
            StandOutWindow
                    .show(this, SimpleWindow.class, StandOutWindow.DEFAULT_ID);
            // show a MultiWindow, SimpleWindow
            setContentView(R.layout.simple);
            final VideoView videoView = (VideoView) findViewById(R.id.videoView1);
                 videoView.setVideoPath("http://10.0.2.2/a.mp4");

             // MediaController mediaController = new MediaController(this);
                //  mediaController.setAnchorView(videoView);
              //    videoView.setMediaController(mediaController);
            videoView.start();
            /*
             * StandOutWindow.show(this, StandOutMostBasicWindow.class,
             * StandOutWindow.DEFAULT_ID);
             */

            finish();
        }
    }

simple.xml

    <?xml version="1.0" encoding="utf-8"?>
    <merge xmlns:android="http://schemas.android.com/apk/res/android" >

        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="128dp"
            android:background="#aaff0000"
            android:orientation="vertical"
            android:padding="8dp" >

            <VideoView
                android:id="@+id/videoView1"
                android:layout_width="200dp"
                android:layout_height="200dp" />

            <ImageView
                android:id="@+id/imageView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_alignParentTop="true"
                android:src="@drawable/close" />

        </RelativeLayout>

    </merge> 
@Shajeel-Afzal
Copy link

Facing same problem. I am getting the following exception:

05-25 15:00:06.475: E/AndroidRuntime(2870): FATAL EXCEPTION: main
05-25 15:00:06.475: E/AndroidRuntime(2870): Process: wei.mark.example, PID: 2870
05-25 15:00:06.475: E/AndroidRuntime(2870): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.ViewRootImpl.setView(ViewRootImpl.java:536)
05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:259)
05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
05-25 15:00:06.475: E/AndroidRuntime(2870): at android.app.Dialog.show(Dialog.java:286)
05-25 15:00:06.475: E/AndroidRuntime(2870): at android.app.AlertDialog$Builder.show(AlertDialog.java:951)
05-25 15:00:06.475: E/AndroidRuntime(2870): at android.widget.VideoView$5.onError(VideoView.java:515)
05-25 15:00:06.475: E/AndroidRuntime(2870): at android.widget.VideoView.openVideo(VideoView.java:354)
05-25 15:00:06.475: E/AndroidRuntime(2870): at android.widget.VideoView.access$2100(VideoView.java:71)
05-25 15:00:06.475: E/AndroidRuntime(2870): at android.widget.VideoView$7.surfaceCreated(VideoView.java:607)
05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.SurfaceView.updateWindow(SurfaceView.java:572)
05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.SurfaceView.access$000(SurfaceView.java:86)
05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:175)
05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:847)
05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1867)
05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:996)
05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5600)
05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.Choreographer.doCallbacks(Choreographer.java:574)
05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.Choreographer.doFrame(Choreographer.java:544)
05-25 15:00:06.475: E/AndroidRuntime(2870): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
05-25 15:00:06.475: E/AndroidRuntime(2870): at android.os.Handler.handleCallback(Handler.java:733)
05-25 15:00:06.475: E/AndroidRuntime(2870): at android.os.Handler.dispatchMessage(Handler.java:95)
05-25 15:00:06.475: E/AndroidRuntime(2870): at android.os.Looper.loop(Looper.java:136)
05-25 15:00:06.475: E/AndroidRuntime(2870): at android.app.ActivityThread.main(ActivityThread.java:5001)
05-25 15:00:06.475: E/AndroidRuntime(2870): at java.lang.reflect.Method.invokeNative(Native Method)
05-25 15:00:06.475: E/AndroidRuntime(2870): at java.lang.reflect.Method.invoke(Method.java:515)
05-25 15:00:06.475: E/AndroidRuntime(2870): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
05-25 15:00:06.475: E/AndroidRuntime(2870): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
05-25 15:00:06.475: E/AndroidRuntime(2870): at dalvik.system.NativeStart.main(Native Method)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants