I'm building an App that plays a mp3 file (hosted on http://<somewhere>/<audio>.mp3) while the user is watching some changing labels (think about a lyrics app, which write the lyrics synchronised with the song).
In the bottom side of the screen I'd like to show the audio controls (play/pause, ff, rew), and a bar for indicating the downloaded part of the file and the playing point.
How is the easiest way to do it? I've already tried with AVAudioPlayer, AVplayer and MPMoviePlayerController, but none of them solved my problem.
You can use MPVolumeView Class.Read the documentation here http://developer.apple.com/library/ios/#documentation/mediaplayer/reference/MPVolumeView_Class/Reference/Reference.html
Related
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!
Currently i am trying to play one youtube video in my application UIWebView. On first time playing, the video is playing perfectly and i can able to see and listen both video & audio, but when the video played completely and i select replay option present in video screen,the video is not displaying anything(its just displaying black screen) but i can able to hear audio.
Where i am going wrong, How to fix this problem ?
Tools used : XCode: 4.3.2, iOS :5.1
I've tried (without success) to get a video to play within a webview. I can see the video thumbnail with the default play button overlaying the video.
When I click the play button - the entire video hi-lights in transparent yellowish/orange. Clicking play again causes the Play button to blink. The thumbnail always remains, but never plays. I can even see the timeline below the video with the play-head, etc. I can never touch the video controls, because every click treats the entire video like one big button - and hi-lights like mentioned above.
They are numerous videos to be played and they are not at YouTube, so launching the YT player with an intent isn't desired.
I'm using SDK 8 (2.2), runing on a 2.3.6 device, and Have the latest Flash Player 11.xxxxx installed.
Any suggestions?
Took another approach in the app.
I'm using mpmovieplayer to play video on ios 4, and I want to keep the audio playing when my app enter background, but it doesn't work. I thing it's because video player use GPU to render video on screen and this is not allowed by apple when app enter background.
So, is there any way to do that? There are some apps have this feature, and they seems just use the mpmovieplayer, is it work by detach the video layer of mpmovieplayer?
Thanks for your answer!
You'll need to have separate audio file and video file for this. Play both when you need to play video and just the audio when app gets into background.
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.