private void h()
 {
   if (!B.p())
   {
     l.e(k, "changeToCastMode error, chromecast is not connected");
     return;
   }
   if (p != null) {
     p.hide();
   }
   m();
   A = 1;
   o.setVisibility(0);
   if (q == null)
   {
     q = new kk(this, this);
     if (r == null)
     {
       r = new kt(this);
       B.a(r);
       B.a(r);
       B.a(r);
     }
     q.setMediaPlayer(r);
     q.setAnchorView(o);
   }
   ((ImageView)z.findViewById(2131624054)).setImageResource(2130838531);
   if ((B.r() > 0) && (B.r() != 2)) {
     b.setVisibility(0);
   }
   J.sendMessageDelayed(J.obtainMessage(5), 1000L);
 }
コード例 #2
0
 @Override
 public void hide() {
   if (mVideoView != null) {
     mVideoView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
   }
   mMediaController.hide();
 }
コード例 #3
0
  @Override
  public boolean dispatchKeyEvent(KeyEvent event) {
    int keyCode = event.getKeyCode();
    if (event.getRepeatCount() == 0
        && event.isDown()
        && (keyCode == KeyEvent.KEYCODE_HEADSETHOOK
            || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE
            || keyCode == KeyEvent.KEYCODE_SPACE)) {
      doPauseResume();
      show(sDefaultTimeout);
      if (mPauseButton != null) {
        mPauseButton.requestFocus();
      }
      return true;
    } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP) {
      if (mPlayer.isPlaying()) {
        mPlayer.pause();
        updatePausePlay();
      }
      return true;
    } else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
      // don't show the controls for volume adjustment
      return super.dispatchKeyEvent(event);
    } else if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_MENU) {
      hide();

      return true;
    } else {
      show(sDefaultTimeout);
    }
    return super.dispatchKeyEvent(event);
  }
コード例 #4
0
 @Override
 protected void onStop() {
   super.onStop();
   mediaController.hide();
   mediaPlayer.stop();
   mediaPlayer.release();
 }
コード例 #5
0
ファイル: VideoView.java プロジェクト: lockapp/androidapp
 public void setMediaController(MediaController controller) {
   if (mMediaController != null) {
     mMediaController.hide();
   }
   mMediaController = controller;
   attachMediaController();
 }
コード例 #6
0
ファイル: VideoView.java プロジェクト: lockapp/androidapp
 private void toggleMediaControlsVisiblity() {
   if (mMediaController.isShowing()) {
     mMediaController.hide();
   } else {
     mMediaController.show();
   }
 }
コード例 #7
0
  @Override
  public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (mIsPrepared
        && keyCode != KeyEvent.KEYCODE_BACK
        && keyCode != KeyEvent.KEYCODE_VOLUME_UP
        && keyCode != KeyEvent.KEYCODE_VOLUME_DOWN
        && keyCode != KeyEvent.KEYCODE_MENU
        && keyCode != KeyEvent.KEYCODE_CALL
        && keyCode != KeyEvent.KEYCODE_ENDCALL
        && mMediaPlayer != null
        && mMediaController != null) {
      if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE) {
        if (mMediaPlayer.isPlaying()) {
          pause();
          mMediaController.show();
        } else {
          start();
          mMediaController.hide();
        }
        return true;
      } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP && mMediaPlayer.isPlaying()) {
        pause();
        mMediaController.show();
      } else {
        toggleMediaControlsVisiblity();
      }
    }

    return super.onKeyDown(keyCode, event);
  }
コード例 #8
0
  public void siguienteCancion() {
    if (!server.finJuego()) {
      new ProgressTask<Canciones>(this) {
        @Override
        protected Canciones work() throws Exception {
          cancion = server.getCanciones();
          return cancion;
        }

        @Override
        protected void onFinish(Canciones cancion) {
          tituloView.setText(cancion.getTitulo());
          String urlCancion = cancion.getVideo();
          playVideo(urlCancion);
        }
      }.execute();
    } else {
      LinearLayout layoutEntero = (LinearLayout) findViewById(R.id.layout_canciones_entero);
      layoutEntero.removeAllViews();
      controller.hide();
      TextView txNuevo = new TextView(this);
      txNuevo.setText("AMAIERA");
      txNuevo.setTextColor(Color.WHITE);
      txNuevo.setGravity(Gravity.CENTER);
      txNuevo.setTextSize(70);
      layoutEntero.addView(txNuevo);
    }
  }
コード例 #9
0
 public boolean onTouch(View v, MotionEvent event) {
   if (event.getAction() == MotionEvent.ACTION_DOWN) {
     if (mShowing) {
       hide();
     }
   }
   return false;
 }
コード例 #10
0
 private void toggleControlsVisibility() {
   if (mediaController.isShowing()) {
     mediaController.hide();
     // debugRootView.setVisibility(View.GONE);
   } else {
     showControls();
   }
 }
コード例 #11
0
ファイル: MjpegVideoView.java プロジェクト: bokri/IPCamViewer
 public void onCompletion(MediaPlayer mp) {
   if (mMediaController != null) {
     mMediaController.hide();
   }
   if (mOnCompletionListener != null) {
     mOnCompletionListener.onCompletion(mMediaPlayer);
   }
 }
コード例 #12
0
ファイル: VideoView.java プロジェクト: Zyanchao/MyYouti
        public boolean onError(MediaPlayer mp, int framework_err, int impl_err) {
          Log.d(TAG, "Error: " + framework_err + "," + impl_err);
          mCurrentState = STATE_ERROR;
          mTargetState = STATE_ERROR;
          if (mMediaController != null) {
            mMediaController.hide();
          }

          /* If an error handler has been supplied, use it and finish. */
          if (mOnErrorListener != null) {
            if (mOnErrorListener.onError(mMediaPlayer, framework_err, impl_err)) {
              return true;
            }
          }

          /* Otherwise, pop up an error dialog so the user knows that
           * something bad has happened. Only try and pop up the dialog
           * if we're attached to a window. When we're going away and no
           * longer have a window, don't bother showing the user an error.
           */
          // modify by lxj
          //            if (getWindowToken() != null) {
          //                Resources r = mContext.getResources();
          //                int messageId;
          //
          //                if (framework_err ==
          // MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK) {
          //                    messageId =
          // com.android.internal.R.string.VideoView_error_text_invalid_progressive_playback;
          //                } else {
          //                    messageId =
          // com.android.internal.R.string.VideoView_error_text_unknown;
          //                }
          //
          //                new AlertDialog.Builder(mContext)
          //                        .setMessage(messageId)
          //
          // .setPositiveButton(com.android.internal.R.string.VideoView_error_button,
          //                                new DialogInterface.OnClickListener() {
          //                                    public void onClick(DialogInterface dialog, int
          // whichButton) {
          //                                        /* If we get here, there is no onError listener,
          // so
          //                                         * at least inform them that the video is over.
          //                                         */
          //                                        if (mOnCompletionListener != null) {
          //
          // mOnCompletionListener.onCompletion(mMediaPlayer);
          //                                        }
          //                                    }
          //                                })
          //                        .setCancelable(false)
          //                        .show();
          //            }
          return true;
        }
コード例 #13
0
 public void surfaceDestroyed(SurfaceHolder holder) {
   // after we return from this we can't use the surface any more
   mSurfaceHolder = null;
   if (mMediaController != null) mMediaController.hide();
   if (mMediaPlayer != null) {
     mMediaPlayer.reset();
     mMediaPlayer.release();
     mMediaPlayer = null;
   }
 }
コード例 #14
0
ファイル: VideoView.java プロジェクト: lockapp/androidapp
 public void onCompletion(MediaPlayer mp) {
   mCurrentState = STATE_PLAYBACK_COMPLETED;
   mTargetState = STATE_PLAYBACK_COMPLETED;
   if (mMediaController != null) {
     mMediaController.hide();
   }
   if (mOnCompletionListener != null) {
     mOnCompletionListener.onCompletion(mMediaPlayer);
   }
 }
コード例 #15
0
 @Override
 public void onStop() {
   super.onStop();
   if (mMenu != null) {
     mMenu.removeItem(R.id.action_share);
     mMenu.removeItem(R.id.action_favorite);
     mMenu.removeItem(R.id.action_unfavorite);
     mMenu = null;
   }
   if (mMediaController != null && mMediaController.isShowing()) {
     mMediaController.hide();
   }
 }
コード例 #16
0
        public boolean onError(MediaPlayer mp, int framework_err, int impl_err) {
          Log.d(TAG, "Error: " + framework_err + "," + impl_err);
          if (mMediaController != null) {
            mMediaController.hide();
          }

          /* If an error handler has been supplied, use it and finish. */
          if (mOnErrorListener != null) {
            if (mOnErrorListener.onError(mMediaPlayer, framework_err, impl_err)) {
              return true;
            }
          }

          /* Otherwise, pop up an error dialog so the user knows that
           * something bad has happened. Only try and pop up the dialog
           * if we're attached to a window. When we're going away and no
           * longer have a window, don't bother showing the user an error.
           */
          if (getWindowToken() != null) {
            Resources r = getContext().getResources();
            String message;

            if (framework_err == MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK) {
              message = "Invalid Progressive Playback";
              // messageId =
              // com.android.internal.R.string.VideoView_error_text_invalid_progressive_playback;
            } else {
              message = "Unknown error";
              // messageId = com.android.internal.R.string.VideoView_error_text_unknown;
            }

            new AlertDialog.Builder(getContext())
                .setTitle("Video View")
                .setMessage(message)
                .setPositiveButton(
                    "Error",
                    new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface dialog, int whichButton) {
                        /* If we get here, there is no onError listener, so
                         * at least inform them that the video is over.
                         */
                        if (mOnCompletionListener != null) {
                          mOnCompletionListener.onCompletion(mMediaPlayer);
                        }
                      }
                    })
                .setCancelable(false)
                .show();
          }
          return true;
        }
コード例 #17
0
 public void invalidateView() {
   final boolean show = controller != null && controller.isShowing();
   if (DEBUG) {
     Log.d(TAG, "Invalidate view, controller showing: " + show);
   }
   if (show) {
     controller.hide();
     // XXX don't know when we have new dimensions, it should be done with something like
     // requestLayout
     final long delay = 250;
     handler.removeCallbacks(showController);
     handler.postDelayed(showController, delay);
   }
 }
コード例 #18
0
ファイル: CustomVideoPlayer.java プロジェクト: kj0604/CarAvn
 @Override
 // POINT: 컨트롤러를 다시 보여 준다.
 public boolean onTouchEvent(MotionEvent ev) {
   if (ev.getAction() == MotionEvent.ACTION_DOWN) {
     if (controller.isShowing()) {
       controller.hide();
       // surfaceView.setLayoutParams(new FrameLayout.LayoutParams(
       // videoWidth, videoHeight));
     } else {
       controller.show();
       // surfaceView.setLayoutParams(new FrameLayout.LayoutParams(
       // videoWidth, videoHeight - 75));
     }
   }
   return false;
 }
コード例 #19
0
 private void k()
 {
   A = 0;
   if (q != null) {
     q.hide();
   }
   o.setVisibility(8);
   Message localMessage = J.obtainMessage(4);
   J.sendMessageDelayed(localMessage, 100L);
   o();
   ((ImageView)z.findViewById(2131624054)).setImageResource(2130838530);
   if (b.getVisibility() == 0) {
     b.setVisibility(8);
   }
   J.removeMessages(5);
 }
コード例 #20
0
 @Override
 public void handleMessage(Message msg) {
   int pos;
   switch (msg.what) {
     case FADE_OUT:
       hide();
       break;
     case SHOW_PROGRESS:
       pos = setProgress();
       if (!mDragging && mShowing && mPlayer.isPlaying()) {
         msg = obtainMessage(SHOW_PROGRESS);
         sendMessageDelayed(msg, 1000 - (pos % 1000));
       }
       break;
   }
 }
コード例 #21
0
 @Override
 public boolean onTouchEvent(MotionEvent event) {
   switch (event.getAction()) {
     case MotionEvent.ACTION_DOWN:
       show(0); // show until hide is called
       break;
     case MotionEvent.ACTION_UP:
       show(sDefaultTimeout); // start timeout
       break;
     case MotionEvent.ACTION_CANCEL:
       hide();
       break;
     default:
       break;
   }
   return true;
 }
コード例 #22
0
  @Override
  public boolean dispatchKeyEvent(KeyEvent event) {
    int keyCode = event.getKeyCode();
    final boolean uniqueDown =
        event.getRepeatCount() == 0 && event.getAction() == KeyEvent.ACTION_DOWN;
    if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK
        || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE
        || keyCode == KeyEvent.KEYCODE_SPACE) {
      if (uniqueDown) {
        doPauseResume();
        show(sDefaultTimeout);
        if (mPauseButton != null) {
          mPauseButton.requestFocus();
        }
      }
      return true;
    } else if (keyCode == KeyEvent.KEYCODE_MEDIA_PLAY) {
      if (uniqueDown && !mPlayer.isPlaying()) {
        mPlayer.start();
        updatePausePlay();
        show(sDefaultTimeout);
      }
      return true;
    } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP || keyCode == KeyEvent.KEYCODE_MEDIA_PAUSE) {
      if (uniqueDown && mPlayer.isPlaying()) {
        mPlayer.pause();
        updatePausePlay();
        show(sDefaultTimeout);
      }
      return true;
    } else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN
        || keyCode == KeyEvent.KEYCODE_VOLUME_UP
        || keyCode == KeyEvent.KEYCODE_VOLUME_MUTE
        || keyCode == KeyEvent.KEYCODE_CAMERA) {
      // don't show the controls for volume adjustment
      return super.dispatchKeyEvent(event);
    } else if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_MENU) {
      if (uniqueDown) {
        hide();
      }
      return true;
    }

    show(sDefaultTimeout);
    return super.dispatchKeyEvent(event);
  }
コード例 #23
0
ファイル: VideoView.java プロジェクト: Kennyc1012/Opengur
        public boolean onError(MediaPlayer mp, int framework_err, int impl_err) {
          Log.d(TAG, "Error: " + framework_err + "," + impl_err);
          mCurrentState = STATE_ERROR;
          mTargetState = STATE_ERROR;
          if (mMediaController != null) {
            mMediaController.hide();
          }

          /* If an error handler has been supplied, use it and finish. */
          if (mOnErrorListener != null) {
            if (mOnErrorListener.onError(mMediaPlayer, framework_err, impl_err)) {
              return true;
            }

            mOnErrorListener = null;
          }

          /* Otherwise, pop up an error dialog so the user knows that
           * something bad has happened. Only try and pop up the dialog
           * if we're attached to a window. When we're going away and no
           * longer have a window, don't bother showing the user an error.
           */
          if (getWindowToken() != null) {
            mMediaPlayer.setOnErrorListener(null);

            new AlertDialog.Builder(getContext())
                .setTitle(R.string.error_generic)
                .setMessage(R.string.loading_image_error)
                .setPositiveButton(
                    R.string.cancel,
                    new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface dialog, int whichButton) {
                        /* If we get here, there is no onError listener, so
                         * at least inform them that the video is over.
                         */
                        if (mOnCompletionListener != null) {
                          mOnCompletionListener.onCompletion(mMediaPlayer);
                        }
                      }
                    })
                .setCancelable(false)
                .show();
          }
          return true;
        }
コード例 #24
0
ファイル: MjpegVideoView.java プロジェクト: bokri/IPCamViewer
        public boolean onError(MediaPlayer mp, int a, int b) {
          Log.d("VideoView", "Error: " + a + "," + b);
          if (mMediaController != null) {
            mMediaController.hide();
          }

          /* If an error handler has been supplied, use it and finish. */
          if (mOnErrorListener != null) {
            if (mOnErrorListener.onError(mMediaPlayer, a, b)) {
              return true;
            }
          }

          /* Otherwise, pop up an error dialog so the user knows that
           * something bad has happened. Only try and pop up the dialog
           * if we're attached to a window. When we're going away and no
           * longer have a window, don't bother showing the user an error.
           */
          if (getWindowToken() != null) {
            Resources r = mContext.getResources();
            new AlertDialog.Builder(mContext)
                // .setTitle(com.android.internal.R.string.VideoView_error_title)
                // .setMessage(com.android.internal.R.string.VideoView_error_text_unknown)
                // .setPositiveButton(com.android.internal.R.string.VideoView_error_button,
                .setTitle("Video Error")
                .setMessage("Video Error unknown")
                .setPositiveButton(
                    "Positive",
                    new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface dialog, int whichButton) {
                        /* If we get here, there is no onError listener, so
                         * at least inform them that the video is over.
                         */
                        if (mOnCompletionListener != null) {
                          mOnCompletionListener.onCompletion(mMediaPlayer);
                        }
                      }
                    })
                .setCancelable(false)
                .show();
          }
          return true;
        }
コード例 #25
0
 @Override
 public boolean dispatchKeyEvent(KeyEvent event) {
   int keyCode = event.getKeyCode();
   if (event.getRepeatCount() == 0
       && event.isDown()
       && (keyCode == KeyEvent.KEYCODE_HEADSETHOOK
           || keyCode == KeyEvent.KEYCODE_PLAYPAUSE
           || keyCode == KeyEvent.KEYCODE_SPACE)) {
     doPauseResume();
     show(sDefaultTimeout);
     return true;
   } else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
     // don't show the controls for volume adjustment
     return super.dispatchKeyEvent(event);
   } else if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_MENU) {
     hide();
   } else {
     show(sDefaultTimeout);
   }
   return super.dispatchKeyEvent(event);
 }
コード例 #26
0
 public void onConfigurationChanged(Configuration paramConfiguration)
 {
   super.onConfigurationChanged(paramConfiguration);
   p.hide();
 }