Play Music In Calls - android

I'm working on an Android project.
its a phone assistant and auto answers the phone and a pre-defined voice plays for the other party. But there is a problem that android doesnt allow us to play audio when a calling is in progress.
so i looked a lot and searched whole web and i found this answer:
https://stackoverflow.com/a/28000021/4254527
This Answer seems to be true. but i dont know how to crate a custom media player. so how can i create a custom media player that doesnt extends from android media player class and plays music during a call.

Related

Xamarin Forms allow music from another app on Android while playing Video

I am facing the issue, that my App Blocks Background Music when using a MediaElement for Video usage.
The bottom line is that I want to play a silent video and the user should still be able to listen to spotify and etc. in the background
In iOS the procedure to allow Background Music is pretty straight forward. On Android I cannot manage to get it working.
I already tried different xamarin.forms libraries where i set the video to mute or the volume to zero.
But nothing seemed to work. I tried for example octane, mediamanager and several other videoplayers.
For this reason, I would now like to try to implement it in the native Android code.
But I haven't found anything about it in various forums.
Xamarin Forms Version is 4.8
You could use a service to stream audio to play audio while your application is not visible or under the lock screen.
You could check the blog about this and download the source file from the Github. https://devblogs.microsoft.com/xamarin/background-audio-streaming-with-xamarin-android/
I test with the sample in the thread i done before to play the audio. libVLCsharp.forms can not play Android resource video file while iOS can
When i make the app which play music in the background, the music would play as well.

YouTube embed: How to enable *non-muted* autoplay in Chrome for Android

This question is basically the same as this one which has a solution for HLTML5 videos, except that changing the chrome://flags to set gesture requirement for media playback to disabled has no influence on a YouTube embedded player.
I have built a webapp I use to learn music, and loop specific parts of Youtube music videos to learn how to play the song. Here is an example. This works fine on a computer, but using Chrome (59) on Android (7.1.1) I have to tap the video each time it starts again to put the sound back on. Not handy when trying to use my hands to learn playing the music ;)
The code I'm using to embed the player and interact via Javascript can be found here.

Google Chromecast receiver doesn't play simultaneous audio

I'm developing a Chromecast application (receiver, HTML5 and Javascript) which communicates with an Android app, all is fine, but I have a problem trying to play two "sounds" at a time in the receiver.
It's a kind of game where I need to play a song at the beggining and play some sound effects during it.
Is this possible? And if it is anyone could help me to do it? I have tried it and it works nice in the browser but in the Chromecast only one of the "sound" is played, the song or the effect, never both.
Thank you very much
You cannot have more than one active Media Element in your DOM in chromecast. For what you want to do, however, you can use Web Audio APIs and accomplish the same for short audio files.

are we able to edit default media player of Honeycomb?

I'd like to add some functionality inside of default media player for honeycomb without making any other class that using mediaPlayer package from Android, such as showing the information for particular video by swiping the screen, etc. Is that possible? if not, there's no other way to make my own class for the media player :(
No, that is not possible: the default media player on Android can not be modified by third party code. If you want to build your own media player you can start by looking at this and in the platform samples, but you will need to do significantly more work to get a fully functional media player.

Android: when implementing a music player in my app, can i make sure there is no other media playing playing music right now?

I want my app to play music while it is running, but I don't want the music to overlap with the music currently being played from a different application (android music app or other external music app such as pandora, grooveshark or winamp).
My question is: is there a way to make sure that nothing else is playing right now regardless of the source?
Thanks!
As of android 2.2 you can use AudioManager.requestAudioFocus(), other audio players should listen for this focus change request and can stop/pause/lower volume of their audio according to what type of audio your focus requests. However not all audio playing apps have bothered to implement this yet.
To be nice you should also listen for audio focus change requests from other apps and pause your apps audio accordingly.
On earlier versions of android calling mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); will usually stop any other music from playing

Categories

Resources