camera countdown timer issue - objective-c

I have an app which record videos, now I can load the camera, record no problem, issue is i am using the function
[imagePickerController setVideoMaximumDuration:5];
property which limits the length of the video, what I'm wondering is if there a way this can be a countdown timer on the video screen.
Thanks

The two are unrelated.
Implement an onscreen countdown via whatever means you want and start it when you start the 5 second duration video recording. Then tear it down when the video stops recording.

Related

Audio player becomes unresponsive after paused for a minute

Building an audio streaming app using just_audio and audio_service. It uses an HLS url stream to get the audio. When audio is playing and the device is locked the controls will show on the lock screen and work properly using play/pause. However if the audio is paused for around a minute or longer the play button is tapped the lock screen controls will turn grey. I'll then open the app and try tapping play in the view and the Audio processing state will change to idle and nothing else happens.
I'm wonder if it has to do with the HLS stream at all. The amount of time that the player has to be paused before it "breaks" varies, but does seem to be consistent with the amount of audio that has buffered. So play/pause works fine if the amount of time the audio has been paused is less than the buffered amount, but if it passes then I encounter this issue.
As far as I can tell, nothing useful is logged at the time the audio player stops working, nor when tapping play/pause while in this state. I've tried to see if the OS kills the audio player maybe so I could re-init, but that doesn't seem to be the case either.
Figured this out, however, I'm not sure it's best solution.
One part is the provider for our HLS url for the live stream was able to increase the session timeout from 45 seconds to 5 minutes. There doesn't seem to be any negative behavior in doing this. It somehow prevents the background controls from breaking (greying out) when the audio has been paused for more then a minute (this varies and doesn't seem directly related to the session timeout, so maybe some magic iOS is doing too, who knows).
The other part is when a user locks their device and interacts with the background player something breaks to the point where if they go back into the app and try to switch the audio source something fails deep in the audio player. To "fix" this, when switching from the live stream to a non-HLS url I am now calling dispose on the audio player in the handler then re-initializing it.
This has solved my problem, but I think a better solution exists. For my specific case, using the SwitchAudioHandler may be that better solution, but I haven't had the time to try it.

How change the duration of a React-Native timing animation dynamically?

I want to know if, once you create a timing Animation in React-Native and start it, can you can update its duration dynamically, without having to stop/recreate the animation? This is the use case that motivated this question:
I am developing a music player in React-Native. I have a simple Player component with a progress bar (slider) like this:
Basically, an Animated.Value is used as the slider's value. When pressing play, a timing animation starts, its duration being the duration of the song. Simultaneously, I control the timers with setInterval(). Every 1000 milliseconds, I add +1 to the timer displayed.
This works fine. Here I have a simple Expo snackbar showing how this works.
The problem is, I want to add a slider that controls the playback speed:
let's ignore the real audio playback and focus only on the slider and timers behavior. If the playback is paused, then when sliding the "Speed factor" slider, it's a very easy change because I only need to update the timers. The progress bar stays the same. But when we're currently playing the song, how do I handle the updates of the timers and the progress bar?
The speed factor slider will adjust the real duration of the song with this formula:
real_duration = normal_duration / speed_factor where speed_factor can be a number between 0.5 and 1.5, for example.
And due to this change duration, I ask whether it is possible to update on the fly an animation's duration, once it has started.

In react-native-video, how do I reset the video player when the video has finished playing?

I have a react-native app with videos that I am displaying using react-native-video. Right now when the video has finished playing you have to manually drag the control for the position of the video back to zero and then press play to have the video restart.
How can I make the video automatically reset when it has been played to the end? (Or even better, is there any way to add a replay button?)
Currently the app is only for iOS.
Try adding repeat value equals to true in Video Component. It will do your work and video will autoplay upon ending.
<Video...repeat={true}/>

Event that fires when video is loaded and first frame is visible? Or how to crossfade two videos another way?

I am trying to use video.js in a samsung smart tv application which unfortunately can only play one video at a time.
I need to simulate the smooth, preferably crossfade, transition between two videos. I am trying to do this by first fading in a screenshot of the next video and using that to cover up the screen while I switch video sources of the video.js plugin. When the player is ready I need to remove the screenshot.
The closest I have found is to remove the screenshot when "loadedmetadata" is called however I am still seeing an inconsistant blip of a black flash between the time the screenshot is removed and the video plays. This is very jarring and I need a consistent way to remove the screenshot only when the first frame has been loaded into the player.
Any other suggestions on how I could each a smooth transition between two videos while only using one video element would be greatly appreciated.
I found the loadeddata event which, as described on MDN :
The loadeddata event is fired when the first frame of the media has finished loading.
loadedmetadata only announce that media informations such as duration are loaded, but the loadeddata event should do the trick.

How to keep specific time delay between the looping of an audio file in MediaPlayer in Android?

I want to build an application for composing music. I have setup buttons that plays sounds but what i need here is to control the time delay after which the sound has to repeat. I have tried setLooping but it loops without any time delay.
you'll have to implement the looping by yourself with help of OnCompletionListener