Change the aspect ratio of surface view according to aspect ratio of the video in exoplayer demo application
<p>I have implemented ExoPlayer in my Android app using the following code.</p>

<pre><code>String versionName;
        try {
            String packageName = getPackageName();
            PackageInfo info = getPackageManager().getPackageInfo(packageName, 0);
            versionName = info.versionName;
        } catch (PackageManager.NameNotFoundException e) {
            versionName = "?";
        }

        player = ExoPlayer.Factory.newInstance(2);


        Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);
        DataSource dataSource = new DefaultUriDataSource(this, null, versionName);

        MediaPresentationDescriptionParser parser = new MediaPresentationDescriptionParser();
        UriDataSource manifestDataSource = new DefaultUriDataSource(this, versionName);
        ManifestFetcher&lt;MediaPresentationDescription&gt; manifestFetcher = new ManifestFetcher&lt;&gt;(passedWorkoutObject.workoutMediaURL, manifestDataSource, parser);

        ExtractorSampleSource sampleSource = new ExtractorSampleSource(
                Uri.parse(VIDEO_URL), dataSource, allocator, BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE);

        MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(
                this, sampleSource, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING);

        MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource);
        player.prepare(videoRenderer, audioRenderer);

        player.sendMessage(videoRenderer, MediaCodecVideoTrackRenderer.MSG_SET_SURFACE, surface);

        player.setPlayWhenReady(true);
        control = new PlayerControl(player);
</code></pre>

<p>The problem however is that I need to play videos of all aspect Ratios. How Do I adjust the surfaceView to fit the size of the video instead of the other way around?</p>