Exemplo n.º 1
0
  /**
   * Sets whether the video should be shown in fullscreen or not.
   *
   * @param value If True, the video will be shown in fullscreen. If False and {@link
   *     VideoPlayer#FullScreen()} returns True, fullscreen mode will be exited. If False and {@link
   *     VideoPlayer#FullScreen()} returns False, nothing occurs.
   */
  @SimpleProperty(userVisible = true)
  public void FullScreen(boolean value) {

    if (value && (SdkLevel.getLevel() <= SdkLevel.LEVEL_DONUT)) {
      container
          .$form()
          .dispatchErrorOccurredEvent(
              this, "FullScreen(true)", ErrorMessages.ERROR_VIDEOPLAYER_FULLSCREEN_UNSUPPORTED);
      return;
    }

    if (value != inFullScreen) {
      if (value) {
        Bundle data = new Bundle();
        data.putInt(FullScreenVideoUtil.VIDEOPLAYER_POSITION, videoView.getCurrentPosition());
        data.putBoolean(FullScreenVideoUtil.VIDEOPLAYER_PLAYING, videoView.isPlaying());
        videoView.pause();
        data.putBoolean(FullScreenVideoUtil.VIDEOPLAYER_FULLSCREEN, true);
        data.putString(FullScreenVideoUtil.VIDEOPLAYER_SOURCE, sourcePath);
        Bundle result =
            container
                .$form()
                .fullScreenVideoAction(
                    FullScreenVideoUtil.FULLSCREEN_VIDEO_ACTION_FULLSCREEN, this, data);
        if (result.getBoolean(FullScreenVideoUtil.ACTION_SUCESS)) {
          inFullScreen = true;
        } else {
          inFullScreen = false;
          container
              .$form()
              .dispatchErrorOccurredEvent(
                  this, "FullScreen", ErrorMessages.ERROR_VIDEOPLAYER_FULLSCREEN_UNAVAILBLE, "");
        }
      } else {
        Bundle values = new Bundle();
        values.putBoolean(FullScreenVideoUtil.VIDEOPLAYER_FULLSCREEN, false);
        Bundle result =
            container
                .$form()
                .fullScreenVideoAction(
                    FullScreenVideoUtil.FULLSCREEN_VIDEO_ACTION_FULLSCREEN, this, values);
        if (result.getBoolean(FullScreenVideoUtil.ACTION_SUCESS)) {
          fullScreenKilled((Bundle) result);
        } else {
          inFullScreen = true;
          container
              .$form()
              .dispatchErrorOccurredEvent(
                  this, "FullScreen", ErrorMessages.ERROR_VIDEOPLAYER_FULLSCREEN_CANT_EXIT, "");
        }
      }
    }
  }
Exemplo n.º 2
0
 @SimpleFunction(
     description =
         "Pauses playback of the video.  Playback can be resumed "
             + "at the same location by calling the <code>Start</code> method.")
 public void Pause() {
   Log.i("VideoPlayer", "Calling Pause");
   if (inFullScreen) {
     container
         .$form()
         .fullScreenVideoAction(FullScreenVideoUtil.FULLSCREEN_VIDEO_ACTION_PAUSE, this, null);
     delayedStart = false;
   } else {
     delayedStart = false;
     videoView.pause();
   }
 }