4-加密视频版权保护
- Best Practices for Video Copyright Protection in VOD
- Configure Account Secret Key
- Configure Token Passing
Best Practices for Video Copyright Protection in VOD
To protect your video assets and enhance playback security, it is recommended that you read the Best Practices for Copyright Protection in advance to understand how POLYV safeguards your video resources.
Configure Account Secret Key
Since the player requires the account secret key secretKey to play videos, if the key is written in plaintext in the code or app configuration file, it can easily be obtained through reverse engineering after the app is packaged, leading to key leakage.
It is recommended that you store the key on your server and define a custom encryption/decryption rule. Before entering the playback page, obtain the encrypted key via a network request, decrypt it at the native layer locally, and then pass it to the player.
Configure Token Passing
By default, any user holding secretKey can obtain the video playback token through POLYV's API and play the video.
You can configure an IP whitelist in the Encryption Settings of the VOD backend. This ensures that only your server can request the API to obtain the playback token, reducing the risk of large-scale video leakage caused by key exposure.
After configuring the IP whitelist, you need to set up the player accordingly to correctly pass the playback token. An example is shown below:
player.getBusinessListenerRegistry().vodTokenRequestListener = {
async onRequestToken(mediaResource: PLVVodMediaResource): Promise<PLVVodVideoTokenVO> {
// 通过网络请求,向您的服务器请求视频播放token
const token: PLVVodVideoTokenVO = await fetchTokenFromNetwork()
// 将token返回给播放器
return token;
}
}
