IPad videos don't play after multiple runs - iphone

I'm working on an IPad application (iOS 3.2) that plays a couple of videos using the MediaPlayer framework. After running the app for a while videos don't play anymore. The video is loaded, meaning i can buffer through it but it's started in pause mode and cannot be set to played. Each time i press play it pauses again. After restarting the device videos behave normal again.
Does anyone have any idea why this strange behavior happens?

Found the solution that worked for me. If i set the MPMoviePlayerController's useApplicationAudioSession to NO then videos play normally.

Related

When playing a movie through a UIWebView, and then outputting to AppleTV via Airplay, turning off iPhone screen stops playback. Why?

When playing a movie through a UIWebView, and then outputting to AppleTV via Airplay, turning off iPhone screen stops playback. Why?
Anyone know how to solve this so AirPlay continues when the screen is off with my app?
Doing these two things solved it for me:
Airplay of audio using AVPlayer does not work in the background (Put the key "audio" as the key in the XML of the property list)
UIWebView: HTML5 audio pauses in iOS 6 when app enters background
Looks like it works for video too!

iOS - Access output audio from background program

Scenario: My app is running in the background. An iPhone/iPad user launches the iPod app (or Pandora or another program that plays audio) on their device and starts playing music. My app detects that that music is now playing, and records or in some way does things with the current playing audio (like stream it to a server), all while still running in the background.
Is this possible? Can anyone point me in the right direction in the SDK on how to do this?
You can't do this. And that is that.

MPMoviePlayerViewController and background audio

I am having trouble playing audio inside a MPMoviePlayerViewController in the background. I can point it to mp3's just fine and listen to the audio, but when I go into the background, I don't hear audio anymore.
I set the plist entry to keep playing audio and set the audio session toAVAudioSessionCategoryPlayback. When I hit the home button, wait a few seconds, and go back to the app, the audio advanced as if it had kept playing, I just can't hear a thing when the app is in the background.
Any idea what causes this?
Thanks!
I just tested in the simulator, and it fails there. It does work fine on the device though. Must be a bug in the simulator.

iOS4 and audio playback during backgrounding

When my app is backgrounded, the audioplayer continues to play, but i cant hear any sound. When i open my app again, it plays from the point where it would have been had the app not been backgrounded at all. This shows that the app is playing in the background though it is not audible. Why could this be happening?
I have set the audio key in the info.plist for the UIBackgroundModes array. Also my audioplayer is set to the "AVAudioSessionCategoryPlayback" category with an override to allow for audio mixing. So what am i doing wrong that im unable to hear the audio even though it is playing in the background?
Could this be an issue with the simulator alone as i have not been able to test this on a device with iOS4 so iv only been testing it on the simulator.
It's an issue with the simulator most likely. I implemented what you stated and it works just fine on the device: Entering background on iOS4 to play audio

MPMoviePlayerController issue after playing back YouTube

I have a MPMoviePlayerController and it plays fine when I play .mov from a server. I can play multiple movies in a row and I am not encountering any issues.
However, I also need to be able to play back some YouTube videos, and have embedded a UIWebView with that allows me to play YouTube videos. Playing several YouTube videos in a row is no problem. The problem occurs if I play a .mov video, and then try to play a YouTube video. The screen shows up with a landscape status bar, but all the controls are still in portrait mode. Sound works, but no video; just a black screen.
Really sounds like a bug to me... you should consider reporting it to Apple, if you haven't already.
It sounds vaguely related to another bug I've run into (the player sometimes keeps playing the audio after the movie is closed, and acts up next time it's launched). The workaround I found was to set
player.initialPlaybackTime = -1.0;
when I unload the player. It's a long shot, but you can give it a try.
The movie player on the simulator has several known bugs, see also:
video playback problems in iphone
Have you tried it on the actual device? I don't bother testing playback on the simulator at all these days.
I've seen this too and it's definitely an Apple bug. Another one you might run into is that tapping on the status bar to scroll to the top of a table after playing a YouTube video doesn't seem to work.
I've seen this happening in one of my apps. The bottom line, is you need to make sure you only have one instance of the MPMoviePlayerController object in your app. If you have more than one all hell breaks loose in OS 3.x, including the symptoms you mention.