My aim is to overlay certain images on top of a video in order to censor pornographic material. The problem is that the videos are not hosted by me. My iOS/Android apps just take the videos from different servers and while showing them have to overlay images to censor any sensitive material. Lets assume, I somehow magically get some meta data from my own server which tells me what I need to censor.
In iOS, I achieved this goal by using an AVPlayer to run the video and an animation of an image that appears over any part of the video that needs to be censored. The animation is synced with the AVPlayer using an AVSynchronized layer which automatically syncs each frame of the video with the associated frame of the animation.
Now, I need to do the same in Android. I've made a transform animation for transforming the overlay image that hides the censored content. I poll the MediaPlayer constantly for the current duration and and using the fps, approximate the current frame and try to sync the animation with the video.
The problem with this is that there is a lot of jitter in the whole thing. If the animation somehow lags behind the video even for a couple of frames, the content I need to censor is shown which beats the whole point of doing this.
In short, I need to sync each frame of animation with the videos frame with the same index. Is there something similar to AVSynchronized layer I can use to achieve this?