In flutter how to show a dialog box for user interaction in video player, on reaching some specific duration - flutter

May be a list of duration in seconds is declared, on attaining the duration, player should pause and show a dialog to the user. If user's answer is success, the video should continue playing, else video should seek to last success answer position if exists else into starting position.
I've tried with different video players with adding listener and seekTo() methods of those players, but
failed.
I have tried with:
1.pod_player: ^0.1.0
result: The player not responding , with audio continuing and video paused.
2.video_player
result: The listener is not working.

Related

React Native Track Player - Resetting Streamed Audio

I am developing an app for a radio station using react-native-track-player. I have this working fine. When I press Pause, the player pauses as expected, but when I press Play again the audio continues where it left off on the stream. I would like to effectively "reset" the stream when paused, so that playing again will always pick up the latest audio - like a radio station should as it's live. I tried removing the track using TrackPlayer.remove([trackIndex]) where trackIndex = await TrackPlayer.getCurrentTrack() but this doesn't have the desired effect, it just carries on where the stream paused.
Can anyone help?
Thanks
When you call pause, you can use reset an after add the tracks
Something like that
TrackPlayer.pause();
TrackPlayer.reset();
TrackPlayer.add(track);

Flutter Implementing pause and play..... Streaming Music

I've tried multiple flutter plug-ins to stream and play and pause music but as of currently, I haven't yet figured out a simple way to implement play and pause, whilst having the ability to avoid music overlapping, I want so that when the current song is playing, if I were to press play on new music track, the current song playing will stop and play the newly pressed song. I've tried flutter_sound, audio player, audio file player, and flute music player but I can't seem to figure out how to do this.
If it is possible either using one of these or a new plug-in, is there a way to implement what I have just described.
The library you seek is more of a multi-track player than a player. Which does not currently exists AFAIK.
The simplest way is to act according to the status of the tracks (which should be given by the player).
Roughly, what I suggest: have something that keeps the status (e.g. paused, playing, completed) of each track. (e.g. List of Tracks) When you press play on track 2 or track 1 finishes playing, you set to 'completed' (or as you wish) the track 1 and set to 'playing' the track 2.
Have a listener on the status of the current track and voila (for autoplay). When the track completes, notify the listener to call a function to start the next one on your list. When you press another track, set to 'completed' the current track and to 'playing' the track you pressed, then notify listeners.
Any library letting you know the status of a track is good enough for your purpose.

Prevent MPMusicPlayerController from playing next song in que

I am creating an app that has a playlist and uses the MediaPlayer library. When a song ends I don't want the next song to start. I tried to use the MPMusicPlayerControllerNowPlayingItemDidChangeNotification to pause the music player when the song changes, but the song starts to play before I get the chance to stop it. I also tried to use KVO to track the changes to musicPlayer.currentPlaybackTime, but I only receive messages when i manually change the playback time. I can't find any information about this problem anywhere.
In my app I have shuffle and repeat off, and create a queue with only one song in it, then send that to the music player. When the song finishes, there aren't any other songs in the queue, so it stops playing.
That being said, the latest iOS update has stopped reporting the correct playback state when the song finishes and is reporting it as paused when it used to be stopped. Not sure if that's a side-effect of the above method or not.
Are you calling:
player.beginGeneratingPlaybackNotifications()
before adding the observers?

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.

MPMoviePlayerViewController method click on pause

I'm using MPMoviePlayerViewController and I want to know if there is a method that can tell me when the user clicks on the Pause button for the video, like an observer?
You should use MPMoviePlayerController instead :
Movie Player Notifications
The MPMoviePlayerController class generates numerous notifications to keep your application informed about the state of movie playback. In addition to being notified when playback finishes, interested clients can be notified in the following situations:
When the movie player begins playing, is paused, or begins seeking forward or backward
When the scaling mode of the movie changes
When the movie enters or exits fullscreen mode
When the load state for network-based movies changes
When meta information about the movie itself becomes available
For more information, see the Notifications section in this document.
http://developer.apple.com/library/ios/#documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/MPMoviePlayerController/MPMoviePlayerController.html