1

I can not put android:configChanges="orientation" in the manifest as it prevents me from changing the layouts when the screen rotates. This is the most common solution to the problem I've found but I think what I'm looking for might be more associated with managing the life-cycle of the activity, which I'm woefully unfamiliar with. Here is my code, if anyone knows a solution. Before anyone mentions dialogs, I don't know if or where I used any. So if that's the issue like I've seen in some other threads here, please feel free to enlighten me. If the mediaController is hidden, no error occurs, but the hide() method hasn't helped me so far either.

public class StreamTestMain extends Activity {

    private static final String nasaStream = "http://www.nasa.gov/multimedia/nasatv/NTV-Public-IPS.m3u8";
    private VideoView videoView;
    private MediaController mediaController;

    /** Called when the activity is first created. */
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_stream_test_main);

        //set up videoView
        videoView = (VideoView)findViewById(R.id.video_player_view);
        videoView.setVideoPath(nasaStream);

        //set up mediaController
        mediaController = new MediaController(this);
        mediaController.setAnchorView(videoView);

        //orientation adjustments
        if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
            //mediaController placement and text display
            mediaController.setPadding(0,0,0,635);
            TextView textView = (TextView)findViewById(R.id.textView);
            textView.setTextSize(40);
            textView.setText("Video Info Here\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nMore Here");
        } else if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
            //hide actionbar when video is fullscreen and don't display text
            getActionBar().hide();
        }//end else if

        //finish setting up videoView and begin stream
        videoView.setMediaController(mediaController);
        videoView.start();
    }//onCreate
}//StreamTestMain

log

06-19 09:07:06.322  14456-14456/com.example.livestreamtest.app E/WindowManager﹕ android.view.WindowLeaked: Activity com.example.livestreamtest.app.StreamTestMain has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{423fbb60 V.E..... R....... 0,0-720,811} that was originally added here
        at android.view.ViewRootImpl.<init>(ViewRootImpl.java:359)
        at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:248)
        at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
        at android.widget.MediaController.show(MediaController.java:346)
        at android.widget.MediaController.show(MediaController.java:306)
        at android.widget.VideoView.toggleMediaControlsVisiblity(VideoView.java:697)
        at android.widget.VideoView.onTouchEvent(VideoView.java:638)
        at android.view.View.dispatchTouchEvent(View.java:7736)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2218)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2218)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2218)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2218)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
        at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2068)
        at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1515)
        at android.app.Activity.dispatchTouchEvent(Activity.java:2466)
        at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2016)
        at android.view.View.dispatchPointerEvent(View.java:7916)
        at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4023)
        at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3902)
        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3452)
        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3502)
        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3471)
        at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3578)
        at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3479)
        at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3635)
        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3452)
        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3502)
        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3471)
        at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3479)
        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3452)
        at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5657)
        at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5588)
        at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5559)
        at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5737)
        at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
        at android.os.MessageQueue.nativePollOnce(Native Method)
        at android.os.MessageQueue.next(MessageQueue.java:138)
        at android.os.Looper.loop(Looper.java:123)
        at android.app.ActivityThread.main(ActivityThread.java:5086)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
        at dalvik.system.NativeStart.main(Native Method)

0 Answers0