AVPlayer buffer - swift

I use AVPlayer for video and I want to see how full is a buffer(in percent). Maybe are there some properties of player that I can use? I know just about "isPlaybackBufferFull" and "isPlaybackBufferEmpty", but I look for value.

Related

iOS Capturing Video

I want to make an app for the iPhone with the ability to record video. One thing I want to do with the video once it's recorded, is to take the audio from it and alter it, such as make it sound feminine or masculine etc. I've never done this before but is it better to use AVFoundation or UIImagePickerController. I've read that the UIImagePickerController is easier to use but will it allow be to extract and edit the audio of the recorded video and put it back in?
Any help or suggestions as to how to approach this are appreciated.
Thanks
It is easiest to capture with UIImagePickerController if you do not need to alter it live. Once the video is captured and you have altered the audio track somehow, write it again using AVFoundation's AVMutableComposition and an audio mix.

Playing a movie file and then various audio files while movie is playing back. (iOS)

Is it possible to play some audio files while my movie is playing. I don't want it to interrupt or pause he movie. Just the audio to play at same time at various predetermined points.
Many Thanks,
-Code
You shouldn't have any problems with it.
If you want to synchronize or delay these players you should use
the code they provide in AvAudioPlayer Class Reference using
playAtTime: method.
Sadly MPMediaPlayback protocol doesn't provide the same method
so exact synchronizing with video is a bit harder task.
EDIT: RoLYroLLs mentions using MPMoviePlayerLoadStateDidChangeNotification to achieve this here and this approach seems promising.
Use two or three Audioplayer at same time . Play that audio when u need it

MPMoviePlayerController - how to tell what bitrate is playing?

The HTTP Live Streaming format supports variable bitrates, which are described in the m3u8 file.
Is it possible to get the bitrate of the currently playing stream?
No, you can't get that information from MPMoviePlayerController
To get the information you want, you could use AVPlayer and AVPlayerItems, which will then create AVAsset items that you can interrogate to discover their properties.
Once you have a AVPlayer, you can find the current AVPlayerItem using currentItem. From that, you can get the asset property.
A AVAsset has AVAssetTracks and this has the formatDescriptions property. Somewhere in there you should find the bitrate.

Movie is played with some delay after calling play on MPMoviePlayerController

I am developing an iPhone application in which I play videos using MPMoviePlayerController.
Sometimes, some of the videos don't play immediately after I call play on MPMoviePlayerController.
I have called prepareToPlay and in the notified method of MPMediaPlaybackIsPreparedToPlayDidChangeNotification, I am calling play on MPMoviePlayerController.
Could someone help in identifying the problem here?
Thanks,
Laxmilal
From my answer in a similar thread (reducing-the-initial-delay-when-playing-remote-video-content) - Note this fragment of the solution is valid for both, remote and local video content.
Use theMPMoviePlayerController.movieSourceTypeproperty when initializing your
player to cut down the media
recognition delay.
From the MPMoviePlayerController Class Reference:
The default value of this property is
MPMovieSourceTypeUnknown. This
property provides a clue to the
playback system as to how it should
download and buffer the movie content.
If you know the source type of the
movie, setting the value of this
property before playback begins can
improve the load times for the movie
content. If you do not set the source
type explicitly before playback, the
movie player controller must gather
this information, which might delay
playback.

MPMoviePlayer or AVPlayer Frame advance

Is there a way to playback a video file frame by frame using either MPMoviePlayer or AVPlayer?
Or even another movie player that I do not know about?
Here is what I want to do. I want to load a video into a fullscreen player and move the content one frame at a time based on user interaction. This will need to be pretty solid as I would need to accurately control what frame the movie player was displaying at any one time.
Ideally I would love to know if it were possible to load a video and control the frame displayed using code.
I know that I could do this using a UIImageView animation but tests show that this uses FAR to much memory.
When using AVPlayer, you can use the - (void)stepByCount:(NSInteger)stepCount method of its current AVPlayerItem to step forward or backward.
AVPlayer *mPlayer = [AVPlayer playerWithURL:url];
[mPlayer.currentItem stepByCount:1];