/**
   * Start a web server.
   *
   * @param callback a callback to return the result.
   */
  public void startWebServer(final OnWebServerStartCallback callback) {
    synchronized (mLockObj) {
      if (mServer == null) {
        mServer = new MixedReplaceMediaServer();
        mServer.setServerName("HostDevicePlugin Server");
        mServer.setContentType("image/jpg");
        final String ip = mServer.start();

        if (!mCameraOverlay.isShow()) {
          mCameraOverlay.show(
              new CameraOverlay.Callback() {
                @Override
                public void onSuccess() {
                  mCameraOverlay.setFinishFlag(false);
                  mCameraOverlay.setServer(mServer);
                  callback.onStart(ip);
                }

                @Override
                public void onFail() {
                  callback.onFail();
                }
              });
        } else {
          mCameraOverlay.setFinishFlag(false);
          mCameraOverlay.setServer(mServer);
          callback.onStart(ip);
        }
      } else {
        callback.onStart(mServer.getUrl());
      }
    }
  }
 /** Stop a web server. */
 public void stopWebServer() {
   synchronized (mLockObj) {
     if (mServer != null) {
       mServer.stop();
       mServer = null;
     }
     mCameraOverlay.hide();
   }
 }