当前位置: 首页>>代码示例>>Java>>正文


Java SmoothStreamingManifest类代码示例

本文整理汇总了Java中com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest的典型用法代码示例。如果您正苦于以下问题:Java SmoothStreamingManifest类的具体用法?Java SmoothStreamingManifest怎么用?Java SmoothStreamingManifest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SmoothStreamingManifest类属于com.google.android.exoplayer.smoothstreaming包,在下文中一共展示了SmoothStreamingManifest类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildRenderers

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest; //导入依赖的package包/类
protected void buildRenderers(SmoothStreamingManifest manifest) {
    if (canceled) {
        return;
    }

    // Check drm support if necessary.
    DrmSessionManager drmSessionManager = null;
    if (manifest.protectionElement != null) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) {
            player.onRenderersError(new UnsupportedDrmException(UnsupportedDrmException.REASON_UNSUPPORTED_SCHEME));
            return;
        }

        try {
            drmSessionManager = StreamingDrmSessionManager.newFrameworkInstance(manifest.protectionElement.uuid, player.getPlaybackLooper(), null, null, player.getMainHandler(), player);
        } catch (UnsupportedDrmException e) {
            player.onRenderersError(e);
            return;
        }
    }

    buildTrackRenderers(drmSessionManager);
}
 
开发者ID:ayaseruri,项目名称:luxunPro,代码行数:24,代码来源:SmoothStreamRenderBuilder.java

示例2: buildRenderers

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest; //导入依赖的package包/类
@Override
public void buildRenderers(DemoPlayer player, RendererBuilderCallback callback) {
  this.player = player;
  this.callback = callback;
  SmoothStreamingManifestParser parser = new SmoothStreamingManifestParser();
  manifestFetcher = new ManifestFetcher<SmoothStreamingManifest>(parser, contentId,
      url + "/Manifest", userAgent);
  manifestFetcher.singleLoad(player.getMainHandler().getLooper(), this);
}
 
开发者ID:Weco,项目名称:android-exoplayer,代码行数:10,代码来源:SmoothStreamingRendererBuilder.java

示例3: buildRenderers

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest; //导入依赖的package包/类
@Override
public void buildRenderers(RendererBuilderCallback callback) {
  this.callback = callback;
  SmoothStreamingManifestParser parser = new SmoothStreamingManifestParser();
  manifestFetcher = new ManifestFetcher<SmoothStreamingManifest>(parser, contentId,
      url + "/Manifest", userAgent);
  manifestFetcher.singleLoad(playerActivity.getMainLooper(), this);
}
 
开发者ID:Weco,项目名称:android-exoplayer,代码行数:9,代码来源:SmoothStreamingRendererBuilder.java

示例4: onSingleManifest

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest; //导入依赖的package包/类
@Override
public void onSingleManifest(SmoothStreamingManifest manifest) {
  if (canceled) {
    return;
  }

  Handler mainHandler = player.getMainHandler();
  LoadControl loadControl = new DefaultLoadControl(new DefaultAllocator(BUFFER_SEGMENT_SIZE));
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(mainHandler, player);

  // Check drm support if necessary.
  DrmSessionManager<FrameworkMediaCrypto> drmSessionManager = null;
  if (manifest.protectionElement != null) {
    if (Util.SDK_INT < 18) {
      player.onRenderersError(
          new UnsupportedDrmException(UnsupportedDrmException.REASON_UNSUPPORTED_SCHEME));
      return;
    }
    try {
      drmSessionManager = StreamingDrmSessionManager.newFrameworkInstance(
          manifest.protectionElement.uuid, player.getPlaybackLooper(), drmCallback, null,
          player.getMainHandler(), player);
    } catch (UnsupportedDrmException e) {
      player.onRenderersError(e);
      return;
    }
  }

  // Build the video renderer.
  DataSource videoDataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  ChunkSource videoChunkSource = new SmoothStreamingChunkSource(manifestFetcher,
      DefaultSmoothStreamingTrackSelector.newVideoInstance(context, true, false),
      videoDataSource, new AdaptiveEvaluator(bandwidthMeter), LIVE_EDGE_LATENCY_MS);
  ChunkSampleSource videoSampleSource = new ChunkSampleSource(videoChunkSource, loadControl,
      VIDEO_BUFFER_SEGMENTS * BUFFER_SEGMENT_SIZE, mainHandler, player,
      DemoPlayer.TYPE_VIDEO);
  TrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context, videoSampleSource,
      MediaCodecSelector.DEFAULT, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000,
      drmSessionManager, true, mainHandler, player, 50);

  // Build the audio renderer.
  DataSource audioDataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  ChunkSource audioChunkSource = new SmoothStreamingChunkSource(manifestFetcher,
      DefaultSmoothStreamingTrackSelector.newAudioInstance(),
      audioDataSource, null, LIVE_EDGE_LATENCY_MS);
  ChunkSampleSource audioSampleSource = new ChunkSampleSource(audioChunkSource, loadControl,
      AUDIO_BUFFER_SEGMENTS * BUFFER_SEGMENT_SIZE, mainHandler, player,
      DemoPlayer.TYPE_AUDIO);
  TrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(audioSampleSource,
      MediaCodecSelector.DEFAULT, drmSessionManager, true, mainHandler, player,
      AudioCapabilities.getCapabilities(context), AudioManager.STREAM_MUSIC);

  // Build the text renderer.
  DataSource textDataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  ChunkSource textChunkSource = new SmoothStreamingChunkSource(manifestFetcher,
      DefaultSmoothStreamingTrackSelector.newTextInstance(),
      textDataSource, null, LIVE_EDGE_LATENCY_MS);
  ChunkSampleSource textSampleSource = new ChunkSampleSource(textChunkSource, loadControl,
      TEXT_BUFFER_SEGMENTS * BUFFER_SEGMENT_SIZE, mainHandler, player,
      DemoPlayer.TYPE_TEXT);
  TrackRenderer textRenderer = new TextTrackRenderer(textSampleSource, player,
      mainHandler.getLooper());

  // Invoke the callback.
  TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
  renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[DemoPlayer.TYPE_TEXT] = textRenderer;
  player.onRenderers(renderers, bandwidthMeter);
}
 
开发者ID:bigjelly,项目名称:ShaddockVideoPlayer,代码行数:71,代码来源:SmoothStreamingRendererBuilder.java

示例5: onSingleManifest

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest; //导入依赖的package包/类
@Override
public void onSingleManifest(SmoothStreamingManifest manifest) {
    buildRenderers(manifest);
}
 
开发者ID:ayaseruri,项目名称:luxunPro,代码行数:5,代码来源:SmoothStreamRenderBuilder.java

示例6: onManifest

import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest; //导入依赖的package包/类
@Override
public void onManifest(String contentId, SmoothStreamingManifest manifest) {
  Handler mainHandler = playerActivity.getMainHandler();
  LoadControl loadControl = new DefaultLoadControl(new BufferPool(BUFFER_SEGMENT_SIZE));
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();

  // Obtain stream elements for playback.
  int maxDecodableFrameSize = MediaCodecUtil.maxH264DecodableFrameSize();
  int audioStreamElementIndex = -1;
  int videoStreamElementIndex = -1;
  ArrayList<Integer> videoTrackIndexList = new ArrayList<Integer>();
  for (int i = 0; i < manifest.streamElements.length; i++) {
    if (audioStreamElementIndex == -1
        && manifest.streamElements[i].type == StreamElement.TYPE_AUDIO) {
      audioStreamElementIndex = i;
    } else if (videoStreamElementIndex == -1
        && manifest.streamElements[i].type == StreamElement.TYPE_VIDEO) {
      videoStreamElementIndex = i;
      StreamElement streamElement = manifest.streamElements[i];
      for (int j = 0; j < streamElement.tracks.length; j++) {
        TrackElement trackElement = streamElement.tracks[j];
        if (trackElement.maxWidth * trackElement.maxHeight <= maxDecodableFrameSize) {
          videoTrackIndexList.add(j);
        } else {
          // The device isn't capable of playing this stream.
        }
      }
    }
  }
  int[] videoTrackIndices = Util.toArray(videoTrackIndexList);

  // Build the video renderer.
  DataSource videoDataSource = new UriDataSource(userAgent, bandwidthMeter);
  ChunkSource videoChunkSource = new SmoothStreamingChunkSource(manifestFetcher,
      videoStreamElementIndex, videoTrackIndices, videoDataSource,
      new AdaptiveEvaluator(bandwidthMeter), LIVE_EDGE_LATENCY_MS);
  ChunkSampleSource videoSampleSource = new ChunkSampleSource(videoChunkSource, loadControl,
      VIDEO_BUFFER_SEGMENTS * BUFFER_SEGMENT_SIZE, true);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(videoSampleSource,
      MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 0, mainHandler, playerActivity, 50);

  // Build the audio renderer.
  DataSource audioDataSource = new UriDataSource(userAgent, bandwidthMeter);
  ChunkSource audioChunkSource = new SmoothStreamingChunkSource(manifestFetcher,
      audioStreamElementIndex, new int[] {0}, audioDataSource,
      new FormatEvaluator.FixedEvaluator(), LIVE_EDGE_LATENCY_MS);
  SampleSource audioSampleSource = new ChunkSampleSource(audioChunkSource, loadControl,
      AUDIO_BUFFER_SEGMENTS * BUFFER_SEGMENT_SIZE, true);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(
      audioSampleSource);
  callback.onRenderers(videoRenderer, audioRenderer);
}
 
开发者ID:Weco,项目名称:android-exoplayer,代码行数:53,代码来源:SmoothStreamingRendererBuilder.java


注:本文中的com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。