private void handleVideoStretch(boolean b) {
   Logging.out(LOG_TAG, "JS command: stretch video ", LogLevel.DEBUG);
   if (mVideoController != null) {
     if (b) {
       mVideoController.setStreachVideoParameter(VideoController.StretchOption.STRECH);
     } else {
       mVideoController.setStreachVideoParameter(VideoController.StretchOption.NO_STRETCH);
     }
   }
 }
  private void handleVideoMute(boolean mute) {
    Logging.out(LOG_TAG, "JS command: video mute " + mute, LogLevel.DEBUG);

    if (mVideoController != null) {
      mVideoController.muteVideo(mute);
    }
  }
  private void handleVideoLoad(String videoUrl) {
    Logging.out(LOG_TAG, "JS command: load video " + videoUrl, LogLevel.DEBUG);

    mIsVideoPresented = true;
    if (mVideoController != null) {
      mVideoController.loadVideoFile(videoUrl, mAd.getContext());
    }
  }
  private void handleVideoPlay(final int time) {
    Logging.out(LOG_TAG, "JS command: play video " + time, LogLevel.DEBUG);

    if (mVideoController != null) {
      mVideoController.playVideo(time);
    }

    if (mDisplayMode == DisplayMode.MINIMIZED) {
      Utils.animateAppear(mMinimizedView);
    }
  }
  @Override
  public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {

    Logging.out(LOG_TAG, "onSurfaceTextureAvailable", LogLevel.DEBUG);

    int viewWidth = 0;
    int viewHeight = 0;

    switch (mDisplayMode) {
      case DisplayMode.MINIMIZED:
        if (mMinimizedMode != null) {
          viewWidth = mMinimizedMode.getWidth();
          viewHeight = mMinimizedMode.getHeight();
        } else {
          Logging.out(LOG_TAG, "WARNING: MinimizedMode is null", LogLevel.ERROR);
        }
        break;

      case DisplayMode.NORMAL:
        viewWidth = mAd.detectWidth();
        viewHeight = mAd.detectHeight();
        break;

      case DisplayMode.FULLSCREEN:
        viewWidth = Utils.getScreenWidth();
        viewHeight = Utils.getScreenHeight();
        break;

      default:
        Logging.out(LOG_TAG, "Unknown display mode", LogLevel.ERROR);
        break;
    }

    if (mVideoController != null) {
      mVideoController.setSurface(mTextureView);
      mVideoController.resizeVideo(mTextureView, viewWidth, viewHeight);
    }
  }
 void destroy(boolean interruptFile) {
   mBridgeListener = null;
   if (mVideoController != null) {
     mVideoController.destroy(interruptFile);
     mVideoController = null;
   }
   if (mAdView != null) {
     mAdView.stopLoading();
     mAdView.clearCache(true);
     mAdView = null;
     Logging.out(LOG_TAG, "AdView destroyed", LogLevel.DEBUG);
   }
   mMinimizedMode = null;
 }
 private void handleVideoPause(int time) {
   Logging.out(LOG_TAG, "JS command: pause video " + time, LogLevel.DEBUG);
   if (mVideoController != null) {
     mVideoController.pauseVideo(time);
   }
 }