IOS Music Control in Background - xcode

I am trying to find the solution to have the control of play/pause when my app is playing the own music in Background. I am using AVAudioPlayer and didnĀ“t find the way to implement this controls. When the app is "close" the music play perfectly but I have to open the app again to pause or change music when needed.
Any solution ?

If you're running iOS 4 you can try putting the app in the background whilst playing music, and then pressing the home button twice for the 'multitasking' bar.
Swipe the bar to the right, which shows you the normal playback controls for Music, YouTube, etc.
If you use the AVAudioPlayer I'm quite sure you can use those same controls to control your app's playback of media.
Bryan
*EDIT does using the remote on the iPhone headphones work?

Related

TMediaPlayer background audio controls on iOS (FMX)

In Rad Studio we have the TMedialPlayer control that can play audio. This thread shows to keep the audio playing after the user locks the screen (Project->Options->Version Info-> UIBackgroundModes set to audio).
However, we have no ability to invoke the iOS audio controls (pause, play) on lock screen. Apple will reject any app that plays audio in the background without displaying the audio controls on lock screen and in control center (Apple documentation on controlling background audio).
Anyone have any good ideas on how this can be achieved (using C++ FMX)?
Can the functions mentioned on that Apple documentation page be called from FMX app?
Is there a third party medial control with this capability (to show the apple audio controls)?

Play/Pause button on the apple tv remote is not working while the video is playing with AVPlayerViewController

I am playing the video through AVPlayerViewController in tvOS (Xamarin tvOS). I am pausing and resuming the video with Play/Pause button on the apple tv remote. I am using the PressesBegan method to get the event on click of Play/Pause button. This is working fine on the simulator but not on the actual devices. On the actual devices, we are not getting the events for pressing the Play/Pause button. We tried it on Apple TV 4K (version 12.11) and Apple TV (version 11.4).
This is only happening when I play the video through AVPlayerViewController otherwise it works fine. I tried UITapGestureRecognizer, PressesEnded method, and also the RemoteControlReceived method. But still, there is no help. Any help will be much appreciated.
https://github.com/lewixlabs/TvOS-PlayBack-Sample-App/blob/master/TvOS%20PlayBack%20Sample%20App/ViewController.cs
Your app will not receive Pause (or Play/Pause) button events when playing video. This is expected--and documented--behavior. The system redirects the action to the "Now Playing" app's handler (which is AVPlayerViewController in this case).
You didn't say why you were trying to intercept Play/Pause...
If you're trying to disable pausing, you should take a different approach; for example, you could disable user interaction on the root view of the AVPlayerViewController (this disables not just play/pause but pretty much all controls). You could also disable the playback controls. Remember that there are multiple ways for a user to pause, including clicking the touch surface, or using a different type of remote or telling Siri to "pause," neither of which will result in regular pause button events.
If you're trying to determine when the video is paused, you could key-value observe the "rate" property of the player (the rate could also to change to zero for other reasons, e.g. because playback reached the end).
Add a UITapGestureRecognizer to ViewController and allow the UIPressType.PlayPause press type.
var tap = new UITapGestureRecognizer(() =>
{
Console.WriteLine("Remote PlayPause button pressed");
})
{
AllowedPressTypes = new NSNumber[] { new NSNumber((long)UIPressType.PlayPause) }
};
this.View.AddGestureRecognizer(tap);

How can I find a list of active plugins on a web page in a browser window

Say I open Youtube,and the video starts playing. How do I find out what in-browser and system plugins / resources are being used to play the music / video?
Asking because on my Firefox, about 50% of the time, when I open youtube, it starts playing the audio of the page in the background, even as the video loads. So when the video is playing, there's audio with it, but there's the same audio, with a small delay playing in the background.
I've tried disabling the extra flash plugin that most other guides about this recommend, and it hasn't helped. Now I want to find out what my browser is using to play the background music.
Simplest thing is probably to right-click on the video and check if the menu that appears is the typical Flash rc-menu or the browser native video right-click menu.

AVAudioPlayer along with seek bar and play pause button

I want to design audio player view to play my audio file.
I am bit confused about AVAudioPlayer working.
When I use AVAudioPlayer, it plays my audio file very well.
But I also want PLAY/PAUSE button and seek bar which will show the progress bar.
My question is that,
is there any inbuilt library or code that I can directly inherit and apply...?
or do I need to create those buttons and seek bar programatically and add them on view while playing the file...?
Thanks in advance.
I tried to search but all shows AVAudioPlayer working,
Nothing found four PLAY/PAUSE buttons additions
I am currently making a music player, and I made my own control view using UIButtons for Play, Pause, Next, Previous, and a UISlider for seeking. There is no built in AvAudioPlayer controls that I know of for this purpose.

Embedding quicktime player in Cocoa app

I'm wondering if it's possible for me to embed the quicktime player in a cocoa app. The default QTMovieView is kind of ugly, and the quicktime player window has all the features I need in it, such as full screen, and the maintain aspect ratio button.
I'd like it to operate transparently to the user though. I'd rather avoid making them launch the quicktime app. I'd also like to be able to position the window on the screen. Also, I need to be able to access the current playhead position, and capture when they stop the movie. Any ideas on how I might go about doing this? Or would I have to build out my own custom video player?
A third party component would be fine as well if any exist. I'm just looking for that same quicktime player appearance with the black control bar that appears when hovering over the screen.
Or would I have to build out my own custom video player?
Yes. There is no (reliable) way of getting QuickTime player to integrate into your application.
You should make a subclass of QTMovieView, and maybe use some subviews for the controls.
You can hide the controls if the QTMovieView if you do not like them. In IB switch off Show Controller property.
Alternatively, you can use QTMovieLayer.
Also, it is easy to create your own set of controls that will work directly with the properties and methods of the QTMovie.

Resources