Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to work with ExoPlayer - lots of unknowns

There is no mention on the internet what on earth is a userAgent, what do I pass as its value and what is it used for. No documentation, nothing. Also, how do I obtain "videoRepresentations" and what is it?

enter image description here

    // Build the video renderer.
    DataSource videoDataSource = new HttpDataSource(userAgent, HttpDataSource.REJECT_PAYWALL_TYPES, bandwidthMeter);
    ChunkSource videoChunkSource = new DashChunkSource(videoDataSource, new AdaptiveEvaluator(bandwidthMeter), videoRepresentations);
    ChunkSampleSource videoSampleSource = new ChunkSampleSource(videoChunkSource, loadControl, VIDEO_BUFFER_SEGMENTS * BUFFER_SEGMENT_SIZE, true);
    MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(videoSampleSource, null, true, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 0, mainHandler, playerActivity, 50);

    // Build the audio renderer.
    DataSource audioDataSource = new HttpDataSource(userAgent, HttpDataSource.REJECT_PAYWALL_TYPES, bandwidthMeter);
    ChunkSource audioChunkSource = new DashChunkSource(audioDataSource, new FormatEvaluator.FixedEvaluator(), audioRepresentation);
    SampleSource audioSampleSource = new ChunkSampleSource(audioChunkSource, loadControl, AUDIO_BUFFER_SEGMENTS * BUFFER_SEGMENT_SIZE, true);
    MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(audioSampleSource, null, true);

Documentation is extremely insufficient http://developer.android.com/guide/topics/media/exoplayer.html

like image 355
Kaloyan Roussev Avatar asked Jan 20 '15 11:01

Kaloyan Roussev


1 Answers

userAgent

  private RendererBuilder getRendererBuilder() {
    String userAgent = DemoUtil.getUserAgent(this);
    switch (contentType) {
      case DemoUtil.TYPE_SS:
        return new SmoothStreamingRendererBuilder(userAgent, contentUri.toString(), contentId,
            new SmoothStreamingTestMediaDrmCallback(), debugTextView);
      case DemoUtil.TYPE_DASH:
        return new DashRendererBuilder(userAgent, contentUri.toString(), contentId,
            new WidevineTestMediaDrmCallback(contentId), debugTextView);
      default:
        return new DefaultRendererBuilder(this, contentUri, debugTextView);
    }
  }

Above code from below link where whole code available with project you just download and use it.

https://raw.githubusercontent.com/google/ExoPlayer/master/demo/src/main/java/com/google/android/exoplayer/demo/full/FullPlayerActivity.java

https://raw.githubusercontent.com/google/ExoPlayer/master/demo/src/main/java/com/google/android/exoplayer/demo/simple/SimplePlayerActivity.java

like image 63
duggu Avatar answered Oct 01 '22 01:10

duggu