private static function createPolicy($partnerId, $policyName, $scenario, $expirationPolicy, $duration = null) { $dbPolicy = new PlayReadyPolicy(); $dbPolicy->setName($policyName); $dbPolicy->setSystemName($policyName); if ($duration) { $dbPolicy->setDuration($duration); } $dbPolicy->setLicenseExpirationPolicy($expirationPolicy); $dbPolicy->setLicenseType(PlayReadyPlugin::getCoreValue('DrmLicenseType', PlayReadyLicenseType::PERSISTENT)); $dbPolicy->setPartnerId($partnerId); $dbPolicy->setProvider(PlayReadyPlugin::getPlayReadyProviderCoreValue()); $dbPolicy->setScenario($scenario); if ($scenario == PlayReadyPlugin::getCoreValue('DrmLicenseScenario', PlayReadyLicenseScenario::RENTAL) || $scenario == PlayReadyPlugin::getCoreValue('DrmLicenseScenario', PlayReadyLicenseScenario::SUBSCRIPTION)) { $playRight = new PlayReadyPlayRight(); $playRight->setFirstPlayExpiration(48); $dbPolicy->setRights(array($playRight)); } if ($scenario == PlayReadyPlugin::getCoreValue('DrmLicenseScenario', PlayReadyLicenseScenario::PURCHASE)) { $copyRight = new PlayReadyCopyRight(); $copyRight->setCopyEnablers(array(PlayReadyCopyEnablerType::DEVICE, PlayReadyCopyEnablerType::PC)); $copyRight->setCopyCount(100); $dbPolicy->setRights(array($copyRight)); } $dbPolicy->setStatus(DrmPolicyStatus::ACTIVE); $dbPolicy->save(); return $dbPolicy; }
private function getDrmKey($entry) { if ($entry) { $drmKey = DrmKeyPeer::retrieveByUniqueKey($entry->getId(), DrmKeyObjectType::ENTRY, PlayReadyPlugin::getPlayReadyProviderCoreValue()); } else { $drmKey = null; } return $drmKey; }
private function getEntryKeyId($entryId) { $drmKey = DrmKeyPeer::retrieveByUniqueKey($entryId, DrmKeyObjectType::ENTRY, PlayReadyPlugin::getPlayReadyProviderCoreValue()); if ($drmKey) { return $drmKey->getDrmKey(); } else { return null; } }
public static function getObjectClass($baseClass, $enumValue) { if ($baseClass == 'KalturaDrmProfile' && $enumValue == PlayReadyPlugin::getPlayReadyProviderCoreValue()) { return 'KalturaPlayReadyProfile'; } if ($baseClass == 'KalturaDrmProfile' && $enumValue == self::getApiValue(PlayReadyProviderType::PLAY_READY)) { return 'KalturaPlayReadyProfile'; } if ($baseClass == 'KalturaDrmPolicy' && $enumValue == PlayReadyPlugin::getPlayReadyProviderCoreValue()) { return 'KalturaPlayReadyPolicy'; } if ($baseClass == 'DrmProfile' && $enumValue == PlayReadyPlugin::getPlayReadyProviderCoreValue()) { return 'PlayReadyProfile'; } if ($baseClass == 'DrmPolicy' && $enumValue == PlayReadyPlugin::getPlayReadyProviderCoreValue()) { return 'PlayReadyPolicy'; } if (class_exists('Kaltura_Client_Client')) { if ($baseClass == 'Kaltura_Client_Drm_Type_DrmProfile' && $enumValue == Kaltura_Client_Drm_Enum_DrmProviderType::PLAY_READY) { return 'Kaltura_Client_PlayReady_Type_PlayReadyProfile'; } if ($baseClass == 'Form_DrmProfileConfigureExtend_SubForm' && $enumValue == Kaltura_Client_Drm_Enum_DrmProviderType::PLAY_READY) { return 'Form_PlayReadyProfileConfigureExtend_SubForm'; } } return null; }