title: Implement Floating View for video streaming
body: <p>I want to implement <code>FloatingView</code>. Which make Activity resize and draggable (like following Picture). I also see this <a href="https://stackoverflow.com/questions/15975988/what-apis-in-android-is-facebook-using-to-create-chat-heads">thread</a> and based on that I create my own <code>service</code>. (Also See <a href="https://github.com/flipkart-incubator/springy-heads" rel="nofollow noreferrer">this</a> &amp; <a href="https://github.com/recruit-lifestyle/FloatingView" rel="nofollow noreferrer">this</a> libraries)</p>
  
  <p>The problem is According to implementation I can't continue Video and Also sometimes Screen goes to black and nothing displayed. I want to know what is the correct way to handle this? Without Video interrupted and continue playing. (I know interruption because of <code>setOnPrepareListener</code> but how avoid that?)</p>
  
  <p>Here is my code:</p>
  
  <pre><code>public class FloatingStream extends Service implements FloatingViewListener {
  
  
      @Override
      public int onStartCommand(Intent intent, int flags, int startId) {
          if (mFloatingViewManager != null) {
              return START_STICKY;
          }
  
  
          final DisplayMetrics metrics = new DisplayMetrics();
          final WindowManager windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
          windowManager.getDefaultDisplay().getMetrics(metrics);
          floatingServiceBinder = new FloatingServiceBinder(this);
          final View rootView = LayoutInflater.from(this).inflate(R.layout.view_exoplayer, null, false);
          final VideoView videoView = (VideoView) rootView.findViewById(R.id.video_view);
          videoView.setVideoURI(Uri.parse(MY_URL));
          videoView.setOnPreparedListener(new OnPreparedListener() {
              @Override
              public void onPrepared() {
                  videoView.start();
              }
          });
  
          mFloatingViewManager = new FloatingViewManager(this, this);
          mFloatingViewManager.setFixedTrashIconImage(R.drawable.ic_play_circle_filled);
          mFloatingViewManager.setActionTrashIconImage(R.drawable.ic_menu);
          final FloatingViewManager.Options options = new FloatingViewManager.Options();
          mFloatingViewManager.addViewToWindow(rootView, options);
  
  
          return START_REDELIVER_INTENT;
      }
  
  } 
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/6cyzB.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6cyzB.gif" alt="enter image description here"></a></p>
  
  <p><strong>Edit:</strong> it's not <a href="https://github.com/pedrovgs/DraggablePanel" rel="nofollow noreferrer">draggable panel</a> because in this app if user go to another activity video not interrupted and still playing.</p>