I have an app that plays videos using the video_player package. These videos have sound, but I don't want to play it. To achieve this, I use:
controller.setVolume(0.0)
The problem is whenever I open the app, even before playing a video, any background music stops.
I figure there must be a way to say "this app does not have sound capability" and then the OS won't pause any background music.
Is there a flutter specific way to do this, or should I look for iOS and Android specific solutions?
Thanks!
Related
I would like to develop an app with which you can control the focus of individual sound outputs, so that you can, for example, play music with Spotify and at the same time play a video via Youtube, which then no longer has any sound. Is something like that even possible?
Thanks for an answer
I was wandering if it would be possible to pause all audio outputs in Android Studio.
As an example, let's say you were listening to Youtube Music or Spotify, what code wouldbe able to pause them. Not mute them. Pause them. Additionally, if it's possible could you make it that it goes back a few seconds (etc. 5s or 2s). Also, I would like it not to require to use any API's as I'd like it to be universal but if that's not possible, I would like it to be able to pause and revert a few seconds in Youtube Music (Premium) and the default Android Music Player.
Thank you.
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.
I have developed a video player application. Now I want to implement Background play functionality. I have checked many video player apps but none of them supports this. However, VLC does support this and when the activity goes in the background or stops then the video continue to play in the background as notification bar i.e. the sound continues to play with a video thumbnail shown in the Notification bar. When tapping on the notification bar it goes to the video page. This is what VLC does.
I am unable to find any tutorial or guide to implementing this. Is it possible to implement something like this?
Show some code what you have tried - that's almost mandatory for questions on SO...
If VLC has this feature then it is possible obviously :) Also YT, if you pay subscription
Also you may check source code of VLC in HERE. For sure it is Service-based implementation, if your app is just simple player then you have probably Activity-based arch and you should migrate to Service
My app plays an audio file. I want my app to pause the audio playing if another apps starts to play audio. I don't want the two audio sounds mess up each other. My app will resume the audio playing after the other app finishes playing its audio. How can I make it? Thanks.
Depending on how your application is running ie. while app is running in foreground (users is looking at your screen) or if your running a "service" which is currently in the background and you wish music to continue playing (songza, slacker radio etc.) how you handle these things will be different. Android uses internal system states to determine which apps should be out-putting audio to the speaker. All this is handled by the audio manager requestAudioFocus() releaseAudioFocus() will be the system calls you will want to look at the most. For a more detailed explanation see android developer api where you this is explained and documented quite well http://developer.android.com/guide/topics/media/mediaplayer.html