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


Java DrmSessionManager类代码示例

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


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

示例1: MediaCodecTrackRenderer

import com.google.android.exoplayer.drm.DrmSessionManager; //导入依赖的package包/类
/**
 * @param source The upstream source from which the renderer obtains samples.
 * @param drmSessionManager For use with encrypted media. May be null if support for encrypted
 *          media is not required.
 * @param playClearSamplesWithoutKeys Encrypted media may contain clear (un-encrypted) regions.
 *          For example a media file may start with a short clear region so as to allow playback
 *          to
 *          begin in parallel with key acquisision. This parameter specifies whether the renderer
 *          is
 *          permitted to play clear regions of encrypted media files before
 *          {@code drmSessionManager}
 *          has obtained the keys necessary to decrypt encrypted regions of the media.
 * @param eventHandler A handler to use when delivering events to {@code eventListener}. May be
 *          null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 */
public MediaCodecTrackRenderer(SampleSource source, DrmSessionManager drmSessionManager,
    boolean playClearSamplesWithoutKeys, Handler eventHandler, EventListener eventListener) {
  Assertions.checkState(Util.SDK_INT >= 16);
  this.source = source.register();
  this.drmSessionManager = drmSessionManager;
  this.playClearSamplesWithoutKeys = playClearSamplesWithoutKeys;
  this.eventHandler = eventHandler;
  this.eventListener = eventListener;
  codecCounters = new CodecCounters();
  sampleHolder = new SampleHolder(SampleHolder.BUFFER_REPLACEMENT_MODE_DISABLED);
  formatHolder = new MediaFormatHolder();
  decodeOnlyPresentationTimestamps = new ArrayList<>();
  outputBufferInfo = new MediaCodec.BufferInfo();
  codecReconfigurationState = RECONFIGURATION_STATE_NONE;
  codecReinitializationState = REINITIALIZATION_STATE_NONE;
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:33,代码来源:MediaCodecTrackRenderer.java

示例2: MediaCodecTrackRenderer

import com.google.android.exoplayer.drm.DrmSessionManager; //导入依赖的package包/类
/**
 * @param sources The upstream sources from which the renderer obtains samples.
 * @param mediaCodecSelector A decoder selector.
 * @param drmSessionManager For use with encrypted media. May be null if support for encrypted
 *     media is not required.
 * @param playClearSamplesWithoutKeys Encrypted media may contain clear (un-encrypted) regions.
 *     For example a media file may start with a short clear region so as to allow playback to
 *     begin in parallel with key acquisition. This parameter specifies whether the renderer is
 *     permitted to play clear regions of encrypted media files before {@code drmSessionManager}
 *     has obtained the keys necessary to decrypt encrypted regions of the media.
 * @param eventHandler A handler to use when delivering events to {@code eventListener}. May be
 *     null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 */
public MediaCodecTrackRenderer(SampleSource[] sources, MediaCodecSelector mediaCodecSelector,
    DrmSessionManager drmSessionManager, boolean playClearSamplesWithoutKeys,
    Handler eventHandler, EventListener eventListener) {
  super(sources);
  Assertions.checkState(Util.SDK_INT >= 16);
  this.mediaCodecSelector = Assertions.checkNotNull(mediaCodecSelector);
  this.drmSessionManager = drmSessionManager;
  this.playClearSamplesWithoutKeys = playClearSamplesWithoutKeys;
  this.eventHandler = eventHandler;
  this.eventListener = eventListener;
  deviceNeedsAutoFrcWorkaround = deviceNeedsAutoFrcWorkaround();
  codecCounters = new CodecCounters();
  sampleHolder = new SampleHolder(SampleHolder.BUFFER_REPLACEMENT_MODE_DISABLED);
  formatHolder = new MediaFormatHolder();
  decodeOnlyPresentationTimestamps = new ArrayList<>();
  outputBufferInfo = new MediaCodec.BufferInfo();
  codecReconfigurationState = RECONFIGURATION_STATE_NONE;
  codecReinitializationState = REINITIALIZATION_STATE_NONE;
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:34,代码来源:MediaCodecTrackRenderer.java

示例3: buildRenderers

import com.google.android.exoplayer.drm.DrmSessionManager; //导入依赖的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

示例4: MediaCodecTrackRenderer

import com.google.android.exoplayer.drm.DrmSessionManager; //导入依赖的package包/类
/**
 * @param source The upstream source from which the renderer obtains samples.
 * @param drmSessionManager For use with encrypted media. May be null if support for encrypted
 *     media is not required.
 * @param playClearSamplesWithoutKeys Encrypted media may contain clear (un-encrypted) regions.
 *     For example a media file may start with a short clear region so as to allow playback to
 *     begin in parallel with key acquisision. This parameter specifies whether the renderer is
 *     permitted to play clear regions of encrypted media files before {@code drmSessionManager}
 *     has obtained the keys necessary to decrypt encrypted regions of the media.
 * @param eventHandler A handler to use when delivering events to {@code eventListener}. May be
 *     null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 */
public MediaCodecTrackRenderer(SampleSource source, DrmSessionManager drmSessionManager,
    boolean playClearSamplesWithoutKeys, Handler eventHandler, EventListener eventListener) {
  Assertions.checkState(Util.SDK_INT >= 16);
  this.source = source;
  this.drmSessionManager = drmSessionManager;
  this.playClearSamplesWithoutKeys = playClearSamplesWithoutKeys;
  this.eventHandler = eventHandler;
  this.eventListener = eventListener;
  codecCounters = new CodecCounters();
  sampleHolder = new SampleHolder(SampleHolder.BUFFER_REPLACEMENT_MODE_DISABLED);
  formatHolder = new MediaFormatHolder();
  decodeOnlyPresentationTimestamps = new ArrayList<Long>();
  outputBufferInfo = new MediaCodec.BufferInfo();

}
 
开发者ID:tyazid,项目名称:Exoplayer_VLC,代码行数:29,代码来源:MediaCodecTrackRenderer.java

示例5: MediaCodecAudioTrackRenderer

import com.google.android.exoplayer.drm.DrmSessionManager; //导入依赖的package包/类
/**
 * @param source The upstream source from which the renderer obtains samples.
 * @param drmSessionManager For use with encrypted content. May be null if support for encrypted
 *     content is not required.
 * @param playClearSamplesWithoutKeys Encrypted media may contain clear (un-encrypted) regions.
 *     For example a media file may start with a short clear region so as to allow playback to
 *     begin in parallel with key acquisision. This parameter specifies whether the renderer is
 *     permitted to play clear regions of encrypted media files before {@code drmSessionManager}
 *     has obtained the keys necessary to decrypt encrypted regions of the media.
 * @param minBufferMultiplicationFactor When instantiating an underlying {@link AudioTrack},
 *     the size of the track's is calculated as this value multiplied by the minimum buffer size
 *     obtained from {@link AudioTrack#getMinBufferSize(int, int, int)}. The multiplication
 *     factor must be greater than or equal to 1.
 * @param eventHandler A handler to use when delivering events to {@code eventListener}. May be
 *     null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 */
public MediaCodecAudioTrackRenderer(SampleSource source, DrmSessionManager drmSessionManager,
    boolean playClearSamplesWithoutKeys, float minBufferMultiplicationFactor,
    Handler eventHandler, EventListener eventListener) {
  super(source, drmSessionManager, playClearSamplesWithoutKeys, eventHandler, eventListener);
  Assertions.checkState(minBufferMultiplicationFactor >= 1);
  this.minBufferMultiplicationFactor = minBufferMultiplicationFactor;
  this.eventListener = eventListener;
  audioTrackReleasingConditionVariable = new ConditionVariable(true);
  if (Util.SDK_INT >= 19) {
    audioTimestampCompat = new AudioTimestampCompatV19();
  } else {
    audioTimestampCompat = new NoopAudioTimestampCompat();
  }
  if (Util.SDK_INT >= 18) {
    try {
      audioTrackGetLatencyMethod = AudioTrack.class.getMethod("getLatency", (Class<?>[]) null);
    } catch (NoSuchMethodException e) {
      // There's no guarantee this method exists. Do nothing.
    }
  }
  playheadOffsets = new long[MAX_PLAYHEAD_OFFSET_COUNT];
  volume = 1.0f;
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:41,代码来源:MediaCodecAudioTrackRenderer.java

示例6: MediaCodecTrackRenderer

import com.google.android.exoplayer.drm.DrmSessionManager; //导入依赖的package包/类
/**
 * @param source The upstream source from which the renderer obtains samples.
 * @param drmSessionManager For use with encrypted media. May be null if support for encrypted
 *     media is not required.
 * @param playClearSamplesWithoutKeys Encrypted media may contain clear (un-encrypted) regions.
 *     For example a media file may start with a short clear region so as to allow playback to
 *     begin in parallel with key acquisision. This parameter specifies whether the renderer is
 *     permitted to play clear regions of encrypted media files before {@code drmSessionManager}
 *     has obtained the keys necessary to decrypt encrypted regions of the media.
 * @param eventHandler A handler to use when delivering events to {@code eventListener}. May be
 *     null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 */
public MediaCodecTrackRenderer(SampleSource source, DrmSessionManager drmSessionManager,
    boolean playClearSamplesWithoutKeys, Handler eventHandler, EventListener eventListener) {
  Assertions.checkState(Util.SDK_INT >= 16);
  this.source = source.register();
  this.drmSessionManager = drmSessionManager;
  this.playClearSamplesWithoutKeys = playClearSamplesWithoutKeys;
  this.eventHandler = eventHandler;
  this.eventListener = eventListener;
  codecCounters = new CodecCounters();
  sampleHolder = new SampleHolder(SampleHolder.BUFFER_REPLACEMENT_MODE_DISABLED);
  formatHolder = new MediaFormatHolder();
  decodeOnlyPresentationTimestamps = new ArrayList<>();
  outputBufferInfo = new MediaCodec.BufferInfo();
  codecReconfigurationState = RECONFIGURATION_STATE_NONE;
  codecReinitializationState = REINITIALIZATION_STATE_NONE;
}
 
开发者ID:raphanda,项目名称:ExoPlayer,代码行数:30,代码来源:MediaCodecTrackRenderer.java

示例7: MediaCodecAudioTrackRenderer

import com.google.android.exoplayer.drm.DrmSessionManager; //导入依赖的package包/类
/**
 * @param source The upstream source from which the renderer obtains samples.
 * @param drmSessionManager For use with encrypted content. May be null if support for encrypted
 *     content is not required.
 * @param playClearSamplesWithoutKeys Encrypted media may contain clear (un-encrypted) regions.
 *     For example a media file may start with a short clear region so as to allow playback to
 *     begin in parallel with key acquisision. This parameter specifies whether the renderer is
 *     permitted to play clear regions of encrypted media files before {@code drmSessionManager}
 *     has obtained the keys necessary to decrypt encrypted regions of the media.
 * @param minBufferMultiplicationFactor When instantiating an underlying {@link android.media.AudioTrack},
 *     the size of the track's is calculated as this value multiplied by the minimum buffer size
 *     obtained from {@link android.media.AudioTrack#getMinBufferSize(int, int, int)}. The multiplication
 *     factor must be greater than or equal to 1.
 * @param eventHandler A handler to use when delivering events to {@code eventListener}. May be
 *     null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 */
public MediaCodecAudioTrackRenderer(SampleSource source, DrmSessionManager drmSessionManager,
    boolean playClearSamplesWithoutKeys, float minBufferMultiplicationFactor,
    Handler eventHandler, EventListener eventListener) {
  super(source, drmSessionManager, playClearSamplesWithoutKeys, eventHandler, eventListener);
  Assertions.checkState(minBufferMultiplicationFactor >= 1);
  this.minBufferMultiplicationFactor = minBufferMultiplicationFactor;
  this.eventListener = eventListener;
  audioTrackReleasingConditionVariable = new ConditionVariable(true);
  if (Util.SDK_INT >= 19) {
    audioTimestampCompat = new AudioTimestampCompatV19();
  } else {
    audioTimestampCompat = new NoopAudioTimestampCompat();
  }
  if (Util.SDK_INT >= 18) {
    try {
      audioTrackGetLatencyMethod = AudioTrack.class.getMethod("getLatency", (Class<?>[]) null);
    } catch (NoSuchMethodException e) {
      // There's no guarantee this method exists. Do nothing.
    }
  }
  playheadOffsets = new long[MAX_PLAYHEAD_OFFSET_COUNT];
  volume = 1.0f;
}
 
开发者ID:lsjwzh,项目名称:ExoPlayerCompat,代码行数:41,代码来源:MediaCodecAudioTrackRenderer.java

示例8: MediaCodecSpeedControllableAudioTrackRenderer

import com.google.android.exoplayer.drm.DrmSessionManager; //导入依赖的package包/类
/**
 * @param source                        The upstream source from which the renderer obtains samples.
 * @param drmSessionManager             For use with encrypted content. May be null if support for encrypted
 *                                      content is not required.
 * @param playClearSamplesWithoutKeys   Encrypted media may contain clear (un-encrypted) regions.
 *                                      For example a media file may start with a short clear region so as to allow playback to
 *                                      begin in parallel with key acquisision. This parameter specifies whether the renderer is
 *                                      permitted to play clear regions of encrypted media files before {@code drmSessionManager}
 *                                      has obtained the keys necessary to decrypt encrypted regions of the media.
 * @param minBufferMultiplicationFactor When instantiating an underlying {@link AudioTrack},
 *                                      the size of the track's is calculated as this value multiplied by the minimum buffer size
 *                                      obtained from {@link AudioTrack#getMinBufferSize(int, int, int)}. The multiplication
 *                                      factor must be greater than or equal to 1.
 * @param eventHandler                  A handler to use when delivering events to {@code eventListener}. May be
 *                                      null if delivery of events is not required.
 * @param eventListener                 A listener of events. May be null if delivery of events is not required.
 */
public MediaCodecSpeedControllableAudioTrackRenderer(SampleSource source, DrmSessionManager drmSessionManager,
                                                     boolean playClearSamplesWithoutKeys, float minBufferMultiplicationFactor,
                                                     Handler eventHandler, EventListener eventListener) {
    super(source, drmSessionManager, playClearSamplesWithoutKeys, eventHandler, eventListener);
    Assertions.checkState(minBufferMultiplicationFactor >= 1);
    this.minBufferMultiplicationFactor = minBufferMultiplicationFactor;
    this.eventListener = eventListener;
    audioTrackReleasingConditionVariable = new ConditionVariable(true);
    if (Util.SDK_INT >= 19) {
        audioTimestampCompat = new AudioTimestampCompatV19();
    } else {
        audioTimestampCompat = new NoopAudioTimestampCompat();
    }
    if (Util.SDK_INT >= 18) {
        try {
            audioTrackGetLatencyMethod = AudioTrack.class.getMethod("getLatency", (Class<?>[]) null);
        } catch (NoSuchMethodException e) {
            // There's no guarantee this method exists. Do nothing.
        }
    }
    playheadOffsets = new long[MAX_PLAYHEAD_OFFSET_COUNT];
    volume = 1.0f;
}
 
开发者ID:skonb,项目名称:MediaCodecSpeedControllableTrackRenderer,代码行数:41,代码来源:MediaCodecSpeedControllableAudioTrackRenderer.java

示例9: shouldWaitForKeys

import com.google.android.exoplayer.drm.DrmSessionManager; //导入依赖的package包/类
private boolean shouldWaitForKeys(boolean sampleEncrypted) throws ExoPlaybackException {
  if (!openedDrmSession) {
    return false;
  }
  int drmManagerState = drmSessionManager.getState();
  if (drmManagerState == DrmSessionManager.STATE_ERROR) {
    throw new ExoPlaybackException(drmSessionManager.getError());
  }
  if (drmManagerState != DrmSessionManager.STATE_OPENED_WITH_KEYS &&
      (sampleEncrypted || !playClearSamplesWithoutKeys)) {
    return true;
  }
  return false;
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:15,代码来源:MediaCodecTrackRenderer.java

示例10: getDrmSessionManagerData

import com.google.android.exoplayer.drm.DrmSessionManager; //导入依赖的package包/类
public static Pair<DrmSessionManager, Boolean> getDrmSessionManagerData(DemoPlayer player,
    MediaDrmCallback drmCallback) throws UnsupportedSchemeException {
  StreamingDrmSessionManager streamingDrmSessionManager = new StreamingDrmSessionManager(
      DemoUtil.WIDEVINE_UUID, player.getPlaybackLooper(), drmCallback, null,
      player.getMainHandler(), player);
  return Pair.create((DrmSessionManager) streamingDrmSessionManager,
      getWidevineSecurityLevel(streamingDrmSessionManager) == SECURITY_LEVEL_1);
}
 
开发者ID:Weco,项目名称:android-exoplayer,代码行数:9,代码来源:DashRendererBuilder.java

示例11: MediaCodecTrackRenderer

import com.google.android.exoplayer.drm.DrmSessionManager; //导入依赖的package包/类
/**
 * @param source The upstream source from which the renderer obtains samples.
 * @param drmSessionManager For use with encrypted media. May be null if support for encrypted
 *     media is not required.
 * @param playClearSamplesWithoutKeys Encrypted media may contain clear (un-encrypted) regions.
 *     For example a media file may start with a short clear region so as to allow playback to
 *     begin in parallel with key acquisision. This parameter specifies whether the renderer is
 *     permitted to play clear regions of encrypted media files before {@code drmSessionManager}
 *     has obtained the keys necessary to decrypt encrypted regions of the media.
 * @param eventHandler A handler to use when delivering events to {@code eventListener}. May be
 *     null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 */
public MediaCodecTrackRenderer(SampleSource source, DrmSessionManager drmSessionManager,
    boolean playClearSamplesWithoutKeys, Handler eventHandler, EventListener eventListener) {
  Assertions.checkState(Util.SDK_INT >= 16);
  this.source = source;
  this.drmSessionManager = drmSessionManager;
  this.playClearSamplesWithoutKeys = playClearSamplesWithoutKeys;
  this.eventHandler = eventHandler;
  this.eventListener = eventListener;
  codecCounters = new CodecCounters();
  sampleHolder = new SampleHolder(SampleHolder.BUFFER_REPLACEMENT_MODE_DISABLED);
  formatHolder = new MediaFormatHolder();
  decodeOnlyPresentationTimestamps = new ArrayList<Long>();
  outputBufferInfo = new MediaCodec.BufferInfo();
}
 
开发者ID:Weco,项目名称:android-exoplayer,代码行数:28,代码来源:MediaCodecTrackRenderer.java

示例12: MediaCodecTrackRenderer

import com.google.android.exoplayer.drm.DrmSessionManager; //导入依赖的package包/类
/**
 * @param source The upstream source from which the renderer obtains samples.
 * @param drmSessionManager For use with encrypted media. May be null if support for encrypted
 *     media is not required.
 * @param playClearSamplesWithoutKeys Encrypted media may contain clear (un-encrypted) regions.
 *     For example a media file may start with a short clear region so as to allow playback to
 *     begin in parallel with key acquisision. This parameter specifies whether the renderer is
 *     permitted to play clear regions of encrypted media files before {@code drmSessionManager}
 *     has obtained the keys necessary to decrypt encrypted regions of the media.
 * @param eventHandler A handler to use when delivering events to {@code eventListener}. May be
 *     null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 */
public MediaCodecTrackRenderer(SampleSource source, DrmSessionManager drmSessionManager,
    boolean playClearSamplesWithoutKeys, Handler eventHandler, EventListener eventListener) {
  Assertions.checkState(Util.SDK_INT >= 16);
  this.source = source;
  this.drmSessionManager = drmSessionManager;
  this.playClearSamplesWithoutKeys = playClearSamplesWithoutKeys;
  this.eventHandler = eventHandler;
  this.eventListener = eventListener;
  codecCounters = new CodecCounters();
  sampleHolder = new SampleHolder(false);
  formatHolder = new MediaFormatHolder();
  decodeOnlyPresentationTimestamps = new HashSet<Long>();
  outputBufferInfo = new MediaCodec.BufferInfo();
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:28,代码来源:MediaCodecTrackRenderer.java

示例13: MediaCodecTrackRenderer

import com.google.android.exoplayer.drm.DrmSessionManager; //导入依赖的package包/类
/**
 * @param source The upstream source from which the renderer obtains samples.
 * @param drmSessionManager For use with encrypted media. May be null if support for encrypted
 *     media is not required.
 * @param playClearSamplesWithoutKeys Encrypted media may contain clear (un-encrypted) regions.
 *     For example a media file may start with a short clear region so as to allow playback to
 *     begin in parallel with key acquisision. This parameter specifies whether the renderer is
 *     permitted to play clear regions of encrypted media files before {@code drmSessionManager}
 *     has obtained the keys necessary to decrypt encrypted regions of the media.
 * @param eventHandler A handler to use when delivering events to {@code eventListener}. May be
 *     null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 */
public MediaCodecTrackRenderer(SampleSource source, DrmSessionManager drmSessionManager,
                               boolean playClearSamplesWithoutKeys, Handler eventHandler, EventListener eventListener) {
  Assertions.checkState(Util.SDK_INT >= 16);
  this.source = source;
  this.drmSessionManager = drmSessionManager;
  this.playClearSamplesWithoutKeys = playClearSamplesWithoutKeys;
  this.eventHandler = eventHandler;
  this.eventListener = eventListener;
  codecCounters = new CodecCounters();
  sampleHolder = new SampleHolder(false);
  formatHolder = new FormatHolder();
  decodeOnlyPresentationTimestamps = new HashSet<Long>();
  outputBufferInfo = new MediaCodec.BufferInfo();
}
 
开发者ID:lsjwzh,项目名称:ExoPlayerCompat,代码行数:28,代码来源:MediaCodecTrackRenderer.java

示例14: getSessionManager

import com.google.android.exoplayer.drm.DrmSessionManager; //导入依赖的package包/类
public static DrmSessionManager getSessionManager(Context context) {
    try {
        return new OfflineDrmSessionManager(getStorage(context));
    } catch (UnsupportedDrmException e) {
        throw new WidevineNotSupportedException(e);
    }
}
 
开发者ID:kaltura,项目名称:player-sdk-native-android,代码行数:8,代码来源:OfflineDrmManager.java

示例15: onSingleManifest

import com.google.android.exoplayer.drm.DrmSessionManager; //导入依赖的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


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