public VLCRendererBuilder(Context context, Uri uri, Properties props)
     throws ExoPlaybackException {
   this.context = context;
   this.uri = LibVLC.PathToURI(uri.toString());
   this.vlc = ExoVlcUtil.getVLC(context);
   this.props = props;
 }
    @Override
    public int configureSurface(Surface surface, final int width, final int height, final int hal) {

      if (LibVlcUtil.isICSOrLater() || surface == null) return -1;
      if (width * height == 0) return 0;
      ExoVlcUtil.log(this, "configureSurface: " + width + "x" + height);

      final ConfigureSurfaceHolder holder = new ConfigureSurfaceHolder(surface);

      final Handler handler = new Handler(Looper.getMainLooper());
      handler.post(
          new Runnable() {
            @Override
            public void run() {
              if (mSurface == holder.surface) {
                if (hal != 0) view.getHolder().setFormat(hal);
                view.getHolder().setFixedSize(width, height);
              }

              synchronized (holder) {
                holder.configured = true;
                holder.notifyAll();
              }
            }
          });

      try {
        synchronized (holder) {
          while (!holder.configured) holder.wait();
        }
      } catch (InterruptedException e) {
        return 0;
      }
      return 1;
    }