twilio / video-quickstart-ios

Twilio Video Quickstart for iOS
https://www.twilio.com/docs/api/video
MIT License
460 stars 178 forks source link

Prevent video to appear on screenshots #507

Closed andschdk closed 4 years ago

andschdk commented 4 years ago

Question

Hi, I was wondering if anyone know if it's potentially possible to prevent any video content from appearing on screenshots taken on the device. I'm thinking in the lines of video playback using AVPlayer/AVPlayerLayer. Here the content is not part of screenshots. Could that somehow be achieved with Twilio you think?

andschdk commented 4 years ago

I think it's called FairPlay Streaming.

ceaglest commented 4 years ago

Hi @andschdk,

That is a good question. The AVPlayer capture protection would only be in place if the content is protected by FairPlay and of course played back by AVPlayer / AVPlayerLayer. The media exchanged in Twilio Video is encrypted with DTLS-SRTP, but this won't be useful for AVPlayer. Once our H.264 decoder receives the NALUs, it might be possible to re-encrypt them with FairPlay and feed this stream into AVPlayer. It seems like a lot of effort to me though.

Couldn't your app register for UIScreenCapturedDidChangeNotification and then obscure the video content (with another UIView, or by hiding) when capture starts?

Edit: Also, you will want to remove sensitive content before your app (or scene) becomes backgrounded.

Best, Chris

andschdk commented 4 years ago

Thank you for your thoughts on this 👍 Using UIScreenCapturedDidChangeNotification will only protect against screen recording if I remember correctly.

ceaglest commented 4 years ago

Yes, I guess you are correct. Still, I just don't know how likely / easy it would be to get video into AVPlayer with low enough delay, and even then it would only be H.264 and not other video codecs.

It is possible to playback video using AVSampleBufferDisplayLayer, but I have not tried to screenshot it.

andschdk commented 4 years ago

I don't think I'll proceed with this - I was just curious to hear your thoughts on this. Thanks, I appreciate it 👍