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


Java FrameworkMediaDrm类代码示例

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


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

示例1: generateDrmSessionManager

import com.google.android.exoplayer2.drm.FrameworkMediaDrm; //导入依赖的package包/类
/**
 * Generates the {@link DrmSessionManager} to use with the {@link RendererProvider}. This will
 * return null on API's < {@value Build.VERSION_CODES#JELLY_BEAN_MR2}
 *
 * @return The {@link DrmSessionManager} to use or <code>null</code>
 */
@Nullable
protected DrmSessionManager<FrameworkMediaCrypto> generateDrmSessionManager() {
    // DRM is only supported on API 18 + in the ExoPlayer
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) {
        return null;
    }

    // Widevine will capture the majority of use cases however playready is supported on all AndroidTV devices
    UUID uuid = C.WIDEVINE_UUID;

    try {
        return new DefaultDrmSessionManager<>(uuid, FrameworkMediaDrm.newInstance(uuid), new DelegatedMediaDrmCallback(), null, mainHandler, capabilitiesListener);
    } catch (Exception e) {
        Log.d(TAG, "Unable to create a DrmSessionManager due to an exception", e);
        return null;
    }
}
 
开发者ID:brianwernick,项目名称:ExoMedia,代码行数:24,代码来源:ExoMediaPlayer.java

示例2: buildDrmSessionManager

import com.google.android.exoplayer2.drm.FrameworkMediaDrm; //导入依赖的package包/类
private DrmSessionManager<FrameworkMediaCrypto> buildDrmSessionManager(UUID uuid,
                                                                       String licenseUrl, Map<String, String> keyRequestProperties) throws UnsupportedDrmException {
    if (Util.SDK_INT < 18) {
        return null;
    }
    HttpMediaDrmCallback drmCallback = new HttpMediaDrmCallback(licenseUrl,
            buildHttpDataSourceFactory(false), keyRequestProperties);
    return new DefaultDrmSessionManager<>(uuid,
            FrameworkMediaDrm.newInstance(uuid), drmCallback, null, mainHandler, eventLogger);
}
 
开发者ID:ashwanijanghu,项目名称:ExoPlayer-Offline,代码行数:11,代码来源:PlayerActivity.java

示例3: create

import com.google.android.exoplayer2.drm.FrameworkMediaDrm; //导入依赖的package包/类
@SuppressWarnings("PMD.PreserveStackTrace")  // We just unwrap the exception because we don't care about the UnsupportedDrmException itself
FrameworkMediaDrm create(UUID uuid) {
    try {
        return FrameworkMediaDrm.newInstance(uuid);
    } catch (UnsupportedDrmException e) {
        throw new FrameworkMediaDrmException(e.getMessage(), e.getCause());
    }
}
 
开发者ID:novoda,项目名称:no-player,代码行数:9,代码来源:FrameworkMediaDrmCreator.java

示例4: create

import com.google.android.exoplayer2.drm.FrameworkMediaDrm; //导入依赖的package包/类
@Override
public DrmSessionManager<FrameworkMediaCrypto> create(DefaultDrmSessionManager.EventListener eventListener) {
    FrameworkMediaDrm frameworkMediaDrm = frameworkMediaDrmCreator.create(WIDEVINE_MODULAR_UUID);

    return new DefaultDrmSessionManager<>(
            WIDEVINE_MODULAR_UUID,
            frameworkMediaDrm,
            mediaDrmCallback,
            NO_OPTIONAL_PARAMETERS,
            handler,
            eventListener
    );
}
 
开发者ID:novoda,项目名称:no-player,代码行数:14,代码来源:StreamingDrmSessionCreator.java

示例5: buildDrmSessionManager

import com.google.android.exoplayer2.drm.FrameworkMediaDrm; //导入依赖的package包/类
private DrmSessionManager<FrameworkMediaCrypto> buildDrmSessionManager(UUID uuid,
                                                                       String licenseUrl, Map<String, String> keyRequestProperties) throws UnsupportedDrmException {
    if (Util.SDK_INT < 18) {
        return null;
    }
    HttpMediaDrmCallback drmCallback = new HttpMediaDrmCallback(licenseUrl,
            buildHttpDataSourceFactory(false), keyRequestProperties);
    return new StreamingDrmSessionManager<>(uuid,
            FrameworkMediaDrm.newInstance(uuid), drmCallback, null, mainHandler, eventLogger);
}
 
开发者ID:AndroidTips,项目名称:MDVideo,代码行数:11,代码来源:PlayerActivityV2.java

示例6: buildDrmSessionManager

import com.google.android.exoplayer2.drm.FrameworkMediaDrm; //导入依赖的package包/类
private DrmSessionManager<FrameworkMediaCrypto> buildDrmSessionManager(UUID uuid,
                                                                       String licenseUrl, Map<String, String> keyRequestProperties) throws UnsupportedDrmException {
  if (Util.SDK_INT < 18) {
    return null;
  }
  HttpMediaDrmCallback drmCallback = new HttpMediaDrmCallback(licenseUrl,
      buildHttpDataSourceFactory(false), keyRequestProperties);
  return new StreamingDrmSessionManager<>(uuid,
      FrameworkMediaDrm.newInstance(uuid), drmCallback, null, mainHandler, eventLogger);
}
 
开发者ID:TakumaMochizuki,项目名称:Komica,代码行数:11,代码来源:PlayerActivity.java

示例7: buildDrmSessionManagerV18

import com.google.android.exoplayer2.drm.FrameworkMediaDrm; //导入依赖的package包/类
private DrmSessionManager<FrameworkMediaCrypto> buildDrmSessionManagerV18(UUID uuid,
    String licenseUrl, String[] keyRequestPropertiesArray, boolean multiSession)
    throws UnsupportedDrmException {
  HttpMediaDrmCallback drmCallback = new HttpMediaDrmCallback(licenseUrl,
      buildHttpDataSourceFactory(false));
  if (keyRequestPropertiesArray != null) {
    for (int i = 0; i < keyRequestPropertiesArray.length - 1; i += 2) {
      drmCallback.setKeyRequestProperty(keyRequestPropertiesArray[i],
          keyRequestPropertiesArray[i + 1]);
    }
  }
  return new DefaultDrmSessionManager<>(uuid, FrameworkMediaDrm.newInstance(uuid), drmCallback,
      null, mainHandler, eventLogger, multiSession);
}
 
开发者ID:y20k,项目名称:transistor,代码行数:15,代码来源:PlayerActivity.java

示例8: buildOfflineDrmSessionManager

import com.google.android.exoplayer2.drm.FrameworkMediaDrm; //导入依赖的package包/类
private DrmSessionManager<FrameworkMediaCrypto> buildOfflineDrmSessionManager(UUID uuid,
                                                                              String licenseUrl, Map<String, String> keyRequestProperties) throws UnsupportedDrmException, IOException, DrmSession.DrmSessionException, InterruptedException {
    if (Util.SDK_INT < 18) {
        return null;
    }

    customDrmCallback = new CustomDrmCallback(
            DemoApplication.getAppInstance().buildHttpDataSourceFactory(new DefaultBandwidthMeter()),
            licenseUrl
    );

    DefaultDrmSessionManager<FrameworkMediaCrypto> drmSessionManager = new DefaultDrmSessionManager<>(uuid,
            FrameworkMediaDrm.newInstance(uuid), customDrmCallback, null, mainHandler, eventLogger);

    String offlineAssetKeyIdStr = DemoApplication.getAppInstance().
            getSharedPreferences().getString(DemoApplication.KEY_OFFLINE_OFFSET_ID,DemoApplication.EMPTY);
    byte[] offlineAssetKeyId = Base64.decode(offlineAssetKeyIdStr, Base64.DEFAULT);
    this.offlineLicenseHelper = OfflineLicenseHelper.newWidevineInstance(customDrmCallback, null);
    Pair<Long, Long> remainingSecPair = offlineLicenseHelper.getLicenseDurationRemainingSec(offlineAssetKeyId);
    Log.e(TAG," License remaining Play time : "+remainingSecPair.first+", Purchase time : "+remainingSecPair.second);
    if(DemoApplication.EMPTY.equals(offlineAssetKeyIdStr) || ( remainingSecPair.first == 0 || remainingSecPair.second == 0)) {
        String path = getIntent().getStringExtra(EXTRA_OFFLINE_URI);
        File file = getUriForManifest(path);
        Uri uri = Uri.fromFile(file);
        InputStream is = new FileInputStream(file);
        Log.e(TAG, "will start download now");
        offlineAssetKeyId = offlineLicenseHelper.download(
                DemoApplication.getAppInstance().buildHttpDataSourceFactory(new DefaultBandwidthMeter()).createDataSource(),
                new DashManifestParser().parse(uri, is));
        Pair<Long, Long> p = offlineLicenseHelper.getLicenseDurationRemainingSec(offlineAssetKeyId);
        Log.e(TAG, "download done : " + p.toString());

        SharedPreferences sharedPreferences = DemoApplication.getAppInstance().getSharedPreferences();
        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.putString(DemoApplication.KEY_OFFLINE_OFFSET_ID,
                Base64.encodeToString(offlineAssetKeyId, Base64.DEFAULT));
        editor.commit();
    }


    drmSessionManager.setMode(DefaultDrmSessionManager.MODE_QUERY,offlineAssetKeyId);
    return drmSessionManager;
}
 
开发者ID:ashwanijanghu,项目名称:ExoPlayer-Offline,代码行数:44,代码来源:PlayerActivity.java


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