@Override
 public void showLogger(boolean show) {
   engine.showLogger(show);
 }
 @Override
 public boolean isResizeToVideoSize() {
   return engine.isResizeToVideoSize();
 }
 @Override
 public void setResizeToVideoSize(boolean resize) {
   engine.setResizeToVideoSize(resize);
 }
 @Override
 public void setRepeatMode(RepeatMode mode) {
   engine.setRepeatMode(mode);
 }
 @Override
 public double getPlayPosition() {
   return engine.getPlayPosition();
 }
 @Override
 public <T extends ConfigValue> void setConfigParameter(ConfigParameter param, T value) {
   engine.setConfigParameter(param, value);
 }
 @Override
 public void setConfigParameter(ConfigParameter param, String value) {
   engine.setConfigParameter(param, value);
 }
 @Override
 public double getVolume() {
   return engine.getVolume();
 }
 @Override
 public void setVolume(double volume) {
   engine.setVolume(volume);
 }
 @Override
 public void playMedia() throws PlayException {
   engine.playMedia();
 }
 @Override
 public void stopMedia() {
   engine.stopMedia();
 }
 @Override
 public void pauseMedia() {
   engine.pauseMedia();
 }
 @Override
 public void loadMedia(String mediaURL) throws LoadException {
   engine.loadMedia(mediaURL);
 }
 @Override
 public void setPlayPosition(double position) {
   engine.setPlayPosition(position);
 }
 @Override
 public double getRate() {
   return engine.getRate();
 }
 /** Returns the remaining number of times this player loops playback before stopping. */
 @Override
 public int getLoopCount() {
   return engine.getLoopCount();
 }
 @Override
 public RepeatMode getRepeatMode() {
   return engine.getRepeatMode();
 }
 /** Sets the number of times the current media file should loop playback before stopping. */
 @Override
 public void setLoopCount(int loop) {
   engine.setLoopCount(loop);
 }
 @Override
 public void setConfigParameter(ConfigParameter param, Number value) {
   engine.setConfigParameter(param, value);
 }
 @Override
 public int getVideoHeight() {
   return engine.getVideoHeight();
 }
 @Override
 public void setRate(double rate) {
   engine.setRate(rate);
 }
 @Override
 public int getVideoWidth() {
   return engine.getVideoWidth();
 }
  /**
   * Constructs <code>CustomVideoPlayer</code> with the specified {@code height} and {@code width}
   * using the specified {@code playerPlugin} to playback media located at {@code mediaURL}. Media
   * playback begins automatically if {@code autoplay} is {@code true}.
   *
   * @param playerPlugin the plugin to use for playback.
   * @param mediaURL the URL of the media to playback
   * @param autoplay {@code true} to start playing automatically, {@code false} otherwise
   * @param height the height of the player
   * @param width the width of the player.
   * @throws LoadException if an error occurs while loading the media.
   * @throws PluginVersionException if the required player plugin version is not installed on the
   *     client.
   * @throws PluginNotFoundException if the player plugin is not installed on the client.
   * @throws NullPointerException if {@code height} or {@code width} is {@code null}
   * @see Plugin
   * @see QuickTimePlayer
   * @see WinMediaPlayer
   * @see FlashMediaPlayer
   */
  public CustomVideoPlayer(
      Plugin playerPlugin, String mediaURL, boolean autoplay, String height, String width)
      throws PluginNotFoundException, PluginVersionException, LoadException {
    if (height == null) {
      throw new NullPointerException("height cannot be null");
    }
    if (width == null) {
      throw new NullPointerException("width cannot be null");
    }

    engine = PlayerUtil.getPlayer(playerPlugin, mediaURL, autoplay, height, "100%");
    engine.addDebugHandler(
        new DebugHandler() {

          @Override
          public void onDebug(DebugEvent event) {
            fireEvent(event);
          }
        });
    engine.addLoadingProgressHandler(
        new LoadingProgressHandler() {

          @Override
          public void onLoadingProgress(LoadingProgressEvent event) {
            fireEvent(event);
          }
        });
    engine.addMediaInfoHandler(
        new MediaInfoHandler() {

          @Override
          public void onMediaInfoAvailable(MediaInfoEvent event) {
            fireEvent(event);
          }
        });
    engine.addPlayStateHandler(
        new PlayStateHandler() {

          @Override
          public void onPlayStateChanged(PlayStateEvent event) {
            fireEvent(event);
          }
        });
    engine.addPlayerStateHandler(
        new PlayerStateHandler() {

          @Override
          public void onPlayerStateChanged(PlayerStateEvent event) {
            switch (event.getPlayerState()) {
              case DimensionChangedOnVideo:
                onVideoDimensionChanged(engine.getOffsetWidth(), engine.getOffsetHeight());
                break;
              default:
                fireEvent(event);
            }
          }
        });

    engine.setConfigParameter(ConfigParameter.WMPUIMode, WinMediaPlayer.UIMode.NONE);
    engine.setControllerVisible(false);
    engine.showLogger(false);

    controller = new SimplePanel();
    controller.setWidth("100%");

    FlowPanel hp = new FlowPanel();
    hp.add(engine);
    hp.add(controller);

    super.initWidget(hp);
    setWidth(width);
  }
 @Override
 public long getMediaDuration() {
   return engine.getMediaDuration();
 }