Exemplo n.º 1
0
 public static void exitFullScreenVideo(HTML5VideoViewProxy proxy, WebViewClassic webView) {
   if (!mHTML5VideoView.fullScreenExited() && mHTML5VideoView.isFullScreenMode()) {
     WebChromeClient client = webView.getWebChromeClient();
     if (client != null) {
       client.onHideCustomView();
     }
   }
 }
Exemplo n.º 2
0
  // Handler for the messages from WebCore or Timer thread to the UI thread.
  @Override
  public void handleMessage(Message msg) {
    // This executes on the UI thread.
    Xlog.d(XLOGTAG, "handleMessage::msg.what is: " + msg.what + this);
    switch (msg.what) {
      case PLAY:
        {
          String url = (String) msg.obj;
          WebChromeClient client = mWebView.getWebChromeClient();
          int videoLayerID = msg.arg1;
          if (client != null) {
            VideoPlayer.play(url, mSeekPosition, this, client, videoLayerID);
          }
          break;
        }
      case ENTER_FULLSCREEN:
        {
          String url = (String) msg.obj;
          WebChromeClient client = mWebView.getWebChromeClient();
          int videoLayerID = msg.arg1;
          if (client != null) {
            VideoPlayer.enterFullScreenVideo(videoLayerID, url, this, mWebView);
          }
          break;
        }
      case SEEK:
        {
          Integer time = (Integer) msg.obj;
          mSeekPosition = time;
          VideoPlayer.seek(mSeekPosition, this);
          break;
        }
      case PAUSE:
        {
          VideoPlayer.pause(this);
          break;
        }
      case ENDED:
        if (msg.arg1 == 1) VideoPlayer.isVideoSelfEnded = true;
        VideoPlayer.end();
        break;
      case ERROR:
        {
          WebChromeClient client = mWebView.getWebChromeClient();
          if (client != null) {
            client.onHideCustomView();
          }
          break;
        }
      case LOAD_DEFAULT_POSTER:
        {
          WebChromeClient client = mWebView.getWebChromeClient();
          if (client != null) {
            doSetPoster(client.getDefaultVideoPoster());
          }
          break;
        }
      case TIMEUPDATE:
        {
          if (VideoPlayer.isPlaying(this)) {
            sendTimeupdate();
          }
          break;
        }
      case BUFFERING_START:
        {
          VideoPlayer.setPlayerBuffering(true);
          break;
        }
      case BUFFERING_END:
        {
          VideoPlayer.setPlayerBuffering(false);
          break;
        }

        /// M: set mute/volume @{
      case SET_VOLUME:
        {
          float volume = ((float) msg.arg1 / 100);
          VideoPlayer.setVolume(volume);
          break;
        }
        /// @}

        /// M: for shutting down player @{
      case TEARDOWN:
        {
          VideoPlayer.teardown();
          break;
        }
        /// @}
    }
  }