Why need to use Media controller and media session? - android-mediaplayer

All most media app also need using Media COntroller and media session. I dont understand why need to use them? if i call direct to MediaPlayer, my apps will run, huh? thank you.

They are needed so that you can control your MediaPlayer even without using the UI,Ex : notifications, Media Buttons etc. and to keep everything in sync.
You can read about it here : Link

They are needed to keep everything in sync:
you can't handle all possible media buttons action using, for example, BroadcastReciever, so that's why we use MediaSession, we create a MediaSessionCallback in the service to respond to all action like(play/pause, next or prev ...) from notification, media buttons, .. and also from our UI(using MediaController)
media buttons: pause/play button in your Bluetooth Headphone for
example...

Related

When having a p2p webtrc connection, how to use different resolutions for the video call and the photo capture?

I'm working on a p2p webtrc video call between HoloLens2 and PC. I also need to support the capturing of photos(and send photos to the server). Now the video and photo can be supported with a resolution of 2272x1278, but I need the photo resolution of 3904x2196(the highest value that HoloLens2 provides).
The problem is when I am trying to change the resolutions, I found I had no limit when the call continues.
I use MediaCapture to take a photo. And the WebcamSource based on MixedReality-WebRTC running on the SharedReadOnly mode. I thought of one way to solve this: shut the call down when taking a photo, and restart it after capturing finished. But the problem is
How can I set the mode to exclusive WebcamSource when just capturing the photo?
Can I make sure when the call had been shut down, the WebcamSource is released?
Or if there is another way to use different resolutions for the video call and the photo capture? Thanks a lot.
How can I set the mode to exclusive WebcamSource when just capturing the photo?
No, SharingMode has hardcoded in the UwpUtils and does not expose any API to access.
Can I make sure when the call had been shut down, the WebcamSource is released?
To make sure dispose of audio and video tracks and media sources last, please reference the following code:
localAudioTrack?.Dispose();
localVideoTrack?.Dispose();
microphoneSource?.Dispose();
webcamSource?.Dispose();

Is it possible to eliminate the the ability to add media to a JSQMessagesViewController

I am integrating this into my app and do not want me users to be able to add media to their message threads. The input messages toolbar documentation does not have any reference to media or attachments. Is it possible to remove this feature from the UI?
This will remove that nasty bugger I put it in the viewDidLoad
self.inputToolbar?.contentView?.leftBarButtonItem = nil

How do I notify users of new content available in tvOS apps from the home screen?

Push notifications have been left out of tvOS (understandably so) but the docs seem to contradict themselves in alerting users to the fact that there is something new available in your tvOS app.
Here it seems to say that you can add an app badge: https://developer.apple.com/library/prerelease/tvos/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/WhatAreRemoteNotif.html
Here it says they've been removed from UIKit: https://developer.apple.com/library/prerelease/tvos/releasenotes/General/tvOS90APIDiffs/Objective-C/UIKit.html
Removed UIApplication.applicationIconBadgeNumber
Assuming the badge approach is not supported in this release, does anyone know the best practice for alerting a user that there is new content in your app without the user taking an explicit action? ie focusing on the app and showing them something in TopShelf?
I encountered the same problem and dived into this. Probably your best way is to update the topshelf with latest items, which is my way to solve this for now. You can use network calls to update the topshelf with content from your backend.
This depends on the type of application. E.g. showing the latest top movies for a movies app.
You can trigger an update of the topshelf after your network call completed using the following code:
NSNotificationCenter.defaultCenter().postNotificationName(TVTopShelfItemsDidChangeNotification, object: nil)
Make sure to implement the TVTopShelfProvider which should be clear using the following documentation:
This protocol is adopted by the principal class of an app’s TV Services extension. Apps that implement this extension can provide dynamic content to the Top Shelf element rather than having the system use the static image submitted with the app. The topShelfStyle property specifies the interface style you want, and the topShelfItems property specifies the content items to display. Whenever you change the content provided by the extension, post a TVTopShelfItemsDidChangeNotification notification to prompt the system to reload your content.
Icon badges are removed for app icons, push notifications as well (except for silent push notifications).

Audio Streaming in Windows8

I want some help on streaming an audio content on Windows8.I have several URL's which i need to play.Not sure if there is any ready to use API for this or anything else.
Can anyone please help ?
Try this:
Combine this with this.
Basically you create an instance of the MediaElement class with a URI like Uri targetUri = new Uri(#"http://www.bing.com"); which points to your audio.
Since you mentioned "several URLs" you'll need to create some sort of "playlist" (which may just be a collection of URLs). You can subscribe to the MediaEnded event of the MediaElement to know when to go to the next track. You'll also want to subscribe to the MediaFailed event in case the network goes down, the audio file is deleted or the audio file is using an unsupported codec.
Finally, consider adding support for audio to continue running in the background even when your application is not focused. This thread should help.

Is it possible to enable or disable VoiceOver within an iOS app?

I would like to be able to turn VoiceOver on or off within my iOS app. The reason for this is I am trying to help a person with disabilities which render her unable to read messages (hence the need for VoiceOver), and who is also unable to triple click the home-button due to motor coordination problems. The way to the setting through Settings>General>Accessibility>VoiceOver>VoiceOver>Flipswitch is far too long and complicated.
Is it possible, without jailbreaking the device, to change this setting in an app? The app doesn't need to make it to the App Store, if that helps.
Alternatively, is it easy to do this with a jailbroken device?
Another approach may be to simulate the triple-click on the home-button that automatically turns on VoiceOver. Is there any way to do this?
Get the app aHomeIcon.
Open the app and tap URL.
Insert the url: prefs:root=General&path=ACCESSIBILITY
Tap 'Done'.
Insert a name to be shown below the icon.
Tap the export button at the bottom of the page. Safari opens.
Add a bookmark and select 'to home-screen'.
Now you can tap that icon and you are redirected to the accessibility part of the settings app.
See this link for reference.