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;
 }
Example #2
0
 public function getLicenseServerUrl()
 {
     if (!parent::getLicenseServerUrl()) {
         return PlayReadyPlugin::getPlayReadyConfigParam('license_server_url');
     }
     return parent::getLicenseServerUrl();
 }
 public function validateForUpdate($sourceObject, $propertiesToSkip = array())
 {
     if (!PlayReadyPlugin::isAllowedPartner(kCurrentContext::getCurrentPartnerId()) || !PlayReadyPlugin::isAllowedPartner($sourceObject->getPartnerId())) {
         throw new KalturaAPIException(KalturaErrors::PERMISSION_NOT_FOUND, 'Permission not found to use the PlayReady feature.');
     }
     return parent::validateForUpdate($sourceObject, $propertiesToSkip);
 }
Example #4
0
 /**
  * @return int
  */
 public function getMinSecurityLevel()
 {
     $level = $this->getFromCustomData(self::CUSTOM_DATA_PLAY_READY_MIN_SECURITY_LEVEL);
     if (!$level) {
         return PlayReadyPlugin::getPlayReadyConfigParam('min_security_level');
     }
     return $level;
 }
 private function getDrmKey($entry)
 {
     if ($entry) {
         $drmKey = DrmKeyPeer::retrieveByUniqueKey($entry->getId(), DrmKeyObjectType::ENTRY, PlayReadyPlugin::getPlayReadyProviderCoreValue());
     } else {
         $drmKey = null;
     }
     return $drmKey;
 }
Example #6
0
 private static function createPolicy($partnerId, $policyName, $scenario, $expirationPolicy, $duration = null)
 {
     $dbPolicy = new DrmPolicy();
     $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(DrmProviderType::CENC);
     $dbPolicy->setScenario($scenario);
     $dbPolicy->setStatus(DrmPolicyStatus::ACTIVE);
     $dbPolicy->save();
     return $dbPolicy;
 }
Example #7
0
 private function getEntryKeyId($entryId)
 {
     $drmKey = DrmKeyPeer::retrieveByUniqueKey($entryId, DrmKeyObjectType::ENTRY, PlayReadyPlugin::getPlayReadyProviderCoreValue());
     if ($drmKey) {
         return $drmKey->getDrmKey();
     } else {
         return null;
     }
 }
Example #8
0
 public static function dependsOn()
 {
     $playReadyDependency = new KalturaDependency(PlayReadyPlugin::getPluginName());
     $ismIndexDependency = new KalturaDependency(IsmIndexPlugin::getPluginName());
     return array($playReadyDependency, $ismIndexDependency);
 }
Example #9
0
 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;
 }