Encrypting FLV and F4V content involves the use of a MediaEncrypter
object. You can also package FLV and F4V files that contain only audio tracks. When encrypting H.264 content for lower-end devices, it may be practical to apply only partial encryption to improve performance. In such cases, an F4V file may be partially encrypted using the F4VDRMParameters.setVideoEncryptionLevel
method.
To encrypt an FLV or an F4V file by using the Java API, perform the following steps:
ServerCredential
instance to load the credentials needed for signing.MediaEncrypter
instance. Use a MediaEncryperFactory
if you do not know what type of file you have. Otherwise you can create an FLVEncrypter
or F4VEncrypter
directly.DRMParameters
object.SignatureParameters
object and pass the ServerCredential
instance to its setServerCredentials
method.V2KeyParameters
object. Set the policies using the setPolicies
method. Set the information needed by the client to contact the license server by calling the setLicenseServerUrl
and setLicenseServerTransportCertificate
methods. Set the CEK encryption options using the setKeyProtectionOptions
method, and its custom properties using the setCustomProperties
method. Finally, depending on the type of encryption used, cast the DRMKeyParameters
object to one of VideoDRMParameters
, AudioDRMParameters
, FLVDRMParameters
, or F4VDRMParameters
, and set the encryption options.MediaEncrypter.encryptContent
method.For sample code demonstrating how to encrypt content, see com.adobe.flashaccess.samples.mediapackager.EncryptContent
in the Reference Implementation Command Line Tools “samples” directory.