Is WindowManager.LayoutParams.preferredDisplayModeId a global, permanent setting? - android

My android tv box doen't make my tv change its frame rate when playing videos, but it allows me to manually change my frame rate through a system setting called HDMI output, however it requires many clicks to get there. I would like to develop an app that mimics the HDMI output system setting.
I saw that WindowManager.LayoutParams.preferredDisplayModeId is supported since android 6.0 while my tv box has android 10.
I have some doubts that this will work because all video players could have used it, but none of them does it, my tv stays at 60hz, while all my videos use 24hz.
If I successfully change my frame rate with WindowManager.LayoutParams.preferredDisplayModeId, will this stay even if my app is terminated? Is this a global setting, just like the HDMI output setting, or is it an app-specific setting?

Related

Android TV/FireOS TV volume control

I want to create a TV app to control output volume. For FireOS TV to be precise.
FireTV Stick does not have any system volume control for its users. So I tried creating a normal TV application to programmatically set volume using AudioManager.setStreamVolume() but it does not works.
To my surprise there is already an App called Precise Volume Control for phones (not optimized for TV) which actually works with FireTV Stick too by sideloading. Not just that, it allows to fine control volume upto 100 levels.
How is precise volume control able to do this in FireTV Stick. Can you point me in the right direction how to achieve this?
Transport controls are probably what you are looking for. They provide access to media playback controls. Can be found here
On TV apps, usually the UI is provided by some Leanback libraries. Which can be found here
There are Leanback Transport controls here
Usually, you would also be responsible for the media that is being played if you use the transport controls.

Sharing audio(Mic) input to multiple apps in Android

As per official documentation
Android 10 (API level 29) and higher imposes a priority scheme that can switch the input audio stream between apps while they are running. In most cases, if a new app acquires the audio input, the previously capturing app continues to run but receives silence. In some cases, the system can continue to deliver audio to both apps. The various sharing scenarios are explained below.
Other than some special cases, audio is not shared between apps.
But I have seen many apps sharing the audio input without being in the above special cases.
For eg. Zoom, when I'm on a call in zoom and start an audio recorder then both the apps are getting audio though zoom audio decreases in intensity.
Similarly, Omlet arcade is able to record mic audio even when mic access is given to other apps.
How is it possible? And as per the documentation, this shouldn't be allowed.
Update:
Was able to achieve it with the usage of Oboe. But it is not consistent on all devices. This also causes a sync issue in my live streaming app. Audio is audible with a delay
This is not possible in Android 5+ . You need a rooted phone to perform this action. In Omlet Arcade Whenever you play a Game and switch ON in-game mic, Omlet Arcade will stop receiving any audio input. However, Omlet Arcade will still function but you have to restart it in order to get voice input back.
Though, in a recent MIUI bug, People were able to listen to calls on Zoom and in-game mic apps. In your case, it might be not official Android and Edited Android like MIUI and OxygenOS

How to update Chromecast MediaMetadata during radio stream?

I recently added the ability to (chrome) cast a radio stream (audio/aac) from my Android radio app. The initial casting works as expected; the stream begins playing on the selected chromecast device and the MediaMetadata I provided is displayed in the Cast Dialog and, if casting to a TV or monitor, on the screen via the receiver app.
When I initially cast the stream I provide the MediaMetadata of the currently playing track. Within my Android app I have a service that can notify me when the track has changed and sends out an updated metadata. The issue I'm having is that I'm struggling to find a way to notify the Chromecast device of this update so that the TV will update the track metadata, show the right title/artist & artwork.
The only partial, hacky way I've found of doing it so far is by calling RemoteMediaClient.load again with the same stream info and the updated MediaMetadata. This approach is not acceptable as it causes the stream to reload, temporarily halting the playing.
I do not see any methods in the RemoteMediaClient that allow for simply updating the MediaMetadata.
The only other post I can find on here that somewhat relates to this is this one, however this now 4 years old and refers to an older version of the SDK that has since been deprecated.
I'm pretty sure the functionality I desire is possible as I've seen this behaviour in other radio apps that include the Chromecast feature.

Android how to keep my music playing even when the phone is lock and sleep

am new in mobile app development, but have try do develop online radio app using Android Studio, but when the app is playing the sound from Icecast it use to stop when the phone is lock and sleep.
Also i find it difficult to set the accurate width that can march any app, the one that i set only work for Small Android Screen. The code full the width of small android phone with android 4.0 but on large screen android phone i can see some space beside and at the bottom of the screen.
Main XML Code
You should use MediaSession since its designed to help you control Media playing and controlling media playback. Check the reference and follow steps for using MediaSession.
Universal Android Music Player
This sample shows how to implement an audio media app that works across multiple form factors and provide a consistent user experience on Android phones, tablets, Android Auto, Android Wear, Android TV and Google Cast devices.
It also work on lock screen.
link to sample app and source code
hope this will help you.

How to Set Media Volume Control for Android Adobe AIR?

In General, JAVA based android app development. we may use...
setVolumeControlStream(AudioManager.STREAM_MUSIC);
So that activity makes volume controller to control MEDIA Volume.
If I want to achieve this in Adobe Air based android app.
How do I do that?
How about building an AIR native extension to interact with the system volume for Android.
Like: https://github.com/nweber/SystemVolumeNativeExtension
Related Explanation article: http://www.adobe.com/devnet/air/articles/building-ane-ios-android-pt1.html
Expected behaviour from the github readme
When changing the volume using the hardware volume keys the system
volume popup will be displayed. The AIR application will be notified
of the new volume after the system volume popup disappears. This
means that the user can press the hardware volume buttons several
times before AIR is notified of a volume change. When changing the
volume from AIR the system volume is changed, but the system volume
popup is not displayed.

Categories

Resources