Implementing a netflix like media player, Preventing screenshots and video captures

徘徊边缘 提交于 2020-02-25 17:08:10

问题


Is there a way to prevent user from taking screenshots or capturing screen of your videos file? Something similar to how Netflix implements it. It returns a black screen whenever we try to click a screen. I just need some starting points in the right direction. Thanks! Edit: it's more related to DRM. And Netflix is implementing it already so there must be surely some way around it.


回答1:


Netflix and similar services encrypt their content and use DRM systems to manage and share the de-cryption keys to authorised users.

Different platforms will use different players and potentially different DRM types - broadly speaking, for the main systems, Apple devices and browsers use fairPlay, Windows devices and browsers use PlayReady and Google devices and Browsers use Widevine.

Its gets a little more complicated when you have a browser from one of the above running on a device from n different one, but the general rule is the browser vendor will decide which DRM is used if it is supported (not all browsers on all devices support DRM).

If you want to use a DRM service you either need to approach the individual DRM suppliers or use a Multi DRM vendor or service supplier.

You can also use a less secure encryption which would not be acceptable to most commercial content owners but which may be good enough for your case - AES encryption or clearly with DASH.

These are not as secure but are sometimes good enough for certain needs.

You can use ffmpeg and openssl to create an AES encrypted HLS stream - the ffmpeg documentation (http://ffmpeg.org/ffmpeg-all.html#Options-34) includes this example script:

#!/bin/sh
BASE_URL=${1:-'.'}
openssl rand 16 > file.key
echo $BASE_URL/file.key > file.keyinfo
echo file.key >> file.keyinfo
echo $(openssl rand -hex 16) >> file.keyinfo
ffmpeg -f lavfi -re -i testsrc -c:v h264 -hls_flags delete_segments \
  -hls_key_info_file file.keyinfo out.m3u8

You can also use mp4Box (https://gpac.wp.imt.fr/mp4box/encryption/common-encryption/) to create basic clearkey DASH encryptions:

MP4Box -crypt drm_file.xml movie.mp4 -out movie_encrypted.mp4

The drm info is included in the drm_file.xml and is explained at the link above.

On the player side, nearly all the main players like BitMovin and JWPlayer on the web via EME, ExoPlayer on android natively etc will support DRM and encrypted playback. These should work as standard detecting the encrypted content, so long as they are configured correctly and will take care of the 'black screen' effect you mention for you.



来源:https://stackoverflow.com/questions/46649681/implementing-a-netflix-like-media-player-preventing-screenshots-and-video-captu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!