code: private void hookDraggablePanelListeners() {
      draggablePanel.setDraggableListener(new DraggableListener() {
        @Override public void onMaximized() {
          playVideo();
        }
  
        @Override public void onMinimized() {
          //Empty
        }
  
        @Override public void onClosedToLeft() {
          pauseVideo();
        }
  
        @Override public void onClosedToRight() {
          pauseVideo();
        }
      });
    }
docs: Hook the DraggableListener to DraggablePanel to pause or resume the video when the
  DragglabePanel is maximized or closed.