title: Play full screen video in texture view in android
body: <p>I want to play video in full screen.</p>
  
  <p>xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"&gt;
  
      &lt;TextureView
              android:id="@+id/textureView"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:rotation="270"/&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>java code:</p>
  
  <p>@Override
          public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i2) {
           Surface surface = new Surface(surfaceTexture);</p>
  
  <pre><code>        try {
              AssetFileDescriptor afd = getAssets().openFd(FILE_NAME);
              mMediaPlayer = new MediaPlayer();
              mMediaPlayer.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
              mMediaPlayer.setSurface(surface);
              mMediaPlayer.setLooping(true);
              mMediaPlayer.prepareAsync();
              mMediaPlayer.setVideoScalingMode(MediaPlayer.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING);
  
              // Play video when the media source is ready for playback.
              mMediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
                  @Override
                  public void onPrepared(MediaPlayer mediaPlayer) {
                      mediaPlayer.start();
                  }
              });
  
          } catch (IllegalArgumentException e) {
              Log.d(TAG, e.getMessage());
          } catch (SecurityException e) {
              Log.d(TAG, e.getMessage());
          } catch (IllegalStateException e) {
              Log.d(TAG, e.getMessage());
          } catch (IOException e) {
              Log.d(TAG, e.getMessage());
          }
      }
  </code></pre>
  
  <p>output:
  <img src="https://i.stack.imgur.com/wWDkQ.png" alt="enter image description here"></p>
  
  <p>How to display full screen video.</p>
  
  <p>Please help me.</p>