Weird frames appear when using TextureView to play video in ListView - android-listview

I managed to play multiple videos in one screen circularly, I added TextureViews to ListView with BaseAdapter which is very common and I created a IjkMediaPlayer (IjkMediaplay github)instance for each textureview. I have reused textureview in getView() callback of BaseAdapter, once getView() called, I stop the previous video and play the new video.
This works fine in most of time, but occasionally, TextureView will display some frames which is not belong to the current video, the frames display for very short time during the playback just like a flash.
With effort, I finally found where the strange frames come, they are from the video which is playing outside of the screen.
The weird frames will not appear if I push up the listview to make the outside textureview show up.
I have record a video to show the scene, in the video you will see 2 videos are playing circularly and a weird frame appear occasionally.
I assert that the weird frame(a white phone on the desk in the frame) is from the video below which is playing outside the screen.
click to download the video
Is this a bug of TextureView on Android, and how to avoid the weird playing?
Who can give me some advices?

Related

Android: Custom video recording app and its quality

I followed the tutorial to create a basic video recorder using the button ("Capture" & "Stop")
Generally it works well but I noticed that if we tap too rapidly on the button to toggle between "Capture to Stop" or from "Stop to Capture", the app stop responding and crashes.
May I know the reason(s) why and how can we solve this issue?
My guess is that it takes time for the app to start the processes of Capture/Stop respectively, and by rapidly tapping the button, the respective processes are force to stop?
Also, I notice the quality of my video recorder is not as good as the default Camera App that comes with Android. (The custom video recorder seems to capture videos of darker and dimmer quality)
Can this issue be solve by adjusting the Camera parameters?
(For e.g. adjust the exposure compensation?)

AirPlay flickering when switching between movies

I have an app that shows list of movies in a table view. When I play them one after another on device it works just great. But when I switch to Apple TV over AirPlay it doesn't work anymore. It play's the first video on ATV ok but after a switch to the next video the screen on ATV start blinking/flickering and after a few seconds it falls back playing on a device. I am using MPMoviePlayerController for playing stream videos.
I also found out that if previous video finished playing over AirPlay it tries to start the next one over AirPlay also. Is this intended behaviour?
Is this kind a related with property allowsAirPlay?
I think I've found a solution. Before you switch playing another video you should stop the previous one:
[self.moviePlayer stop];
This is not needed if you are not playing via AirPlay cos the next video will automatically stop previous one by nature - you can not play two videos at once.
But If you do play video over AirPlay you need to stop previous one first and than play the next one.
This solution works for me.

How do I pause video at the exact moment I capture a photo?

I am using AVFoundation to display a Video in my UIView via an AVCaptureVideoPreviewOverlay.
I then use AVStillImageOutput's -captureStillImageAsynchronouslyFromConnection: to capture a still Image from the Video with the AVCaptureSessionPresetPhoto preset.
I am freezing the video using AVCaptureSession's -stopRunning in the -captureStillImageAsynchronouslyFromConnection completion block mentioned earlier. However, it's too late and the video has continued running while the still image is taken, so the freeze is a second or two later. When I display the image there is a jump.
How can I freeze the video at the exact moment the photo is taken?
Almost a year later...Your approach is all wrong. Instead of trying to pause the video at the precise moment that the image is captured why don't you pause the video and then capture that paused image. To a user it makes no difference, to a developer you don't have to worry about exact precision.
To reiterate my idea, if you pause a video and flash white visual and play a click the user will think you have just captured that frame regardless if you are or not. Actually, you could consider pausing video the same as capturing an image without saving it.

Playing the multiple Audio files in different Views using single audio player instance in iphone,

I am new to audio playing, I am having one issue regarding Audio playing .The issue is Playing the multiple audio files , and controlling the current playing audio file from other Views.
My Requirement is. In my app i am having 4 audio files in different Views. Once the audio play button is clicked in some View, The audio playing has to be started and pause and stop and slider buttons has to be displayed , Even i navigated to the next view the audio has to be continued (I should be able to control the currently playing audio), If i pressed the navigated view's audio, The previous audio has to be stopped, Navigated page audio has to be played. After completion of Navigated page Audio, the resumed audio of Previous page has to be played.
As of my knowledge, I have take single audio instance in AppDelegate. I am referring that Audioplayer instance in all view's , Where ever i need. It is not working.(some times giving error , some times unable to stop the Previous Audio playing).
Thanks in advance.
if i am not wrong you have defined the audioplayer in appdelegate, right?
and which class are you using for this , avplayer , avaudioplayer or mpplayer ?
and by the way , if we come to answer of mine,
i have used avplayer and avaudioplayer for this kind of business and it worked without problem , have you checked that in everyview you initialize you appdelegate instance? if not please check this and
also in your plist file , you should state that app will play audio in background to get the support for that.
hope this answer will help! :)

AVPlayer - Benny Hill style speeded up video issue

I'm using AVPlayer to show a live stream. Works fine. Part of my app requires a modal view to appear over the video. Actually, it flips the video view to show the modal view. I want the video's audio to keep playing, which it does fine.
However, the problem is when I return to the video. The video's visuals speed up for a few seconds, Benny Hill style, to compensate for the period they were off the screen. Then the video starts playing normally. Is there a way to stop this speed up? If not, can I remove the visual element until the speeded up bit stops.