I've created a cordova android application that stream video content from a ustream channel, and its working fine, I now want the app to keep playing the stream when its on a background. At the moment the video stream stops about 2 or 3 seconds after the app goes to background.
Is there a plugin that I can use to achieve that ? I believe this issue is not specific to ustream channels.
Thanks
Android platform has a right to passivate or terminate an application when it's no longer visible. If you need to perform actions when the application is not visible, you have to implement and register a service to do it. More information about Android services can be read here: http://developer.android.com/guide/components/services.html
Related
Is there a flutter solution to securing music app from screen recorder (Even the app runs in the background), like apple music app did, stop the music when you start screen recorder. We have tried windowmanager package & secure application but no one works in IOS.
We have a mobile app to stream music, the app implement in-app purchase, every song should be bought before listening, and the content is exclusive for the app. that's why we need to secure the app, we have searched a lot for flutter packages and native implementations but we haven’t find a solution for IOS specific .
You should implement this natively for iOS.
Use isCaptured property in UIScreen to know if screen recording is happening (you can do this for iOS 11+)
You can use Key-Value Observing to know when isCaptured changes
Apple says:
To prevent the system from recording the audio portion, observe the isCaptured property and take appropriate action in your app as described...
see the documentation
EDIT:
I've found this library flutter_forbidshot it is helpful, and I think it is suitable for this problem.
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 am building music player application for android phone using cordova media plugin.
With the help of plugin i am able to play the local music now i wants to add a feature that even if the application is closed by the user.
Music player should run in background with play,pause,exit options available in notification bar.
Can any one help me in this case.
Thanks in advance
I'm using this plugin here, and it works for me on android:
https://github.com/homerours/cordova-music-controls-plugin
It does not control the media for you automatically though, you have handle its events and control the media yourself.
Keep in mind that at the moment, if your app is closed in the background by the system, the notification will still be shown. This is a known bug.
Can anyone help me to know how to stop the background music playing on android once I open my application in Android (I'm using Appcelerator Titanium)
Titanium Mobile doesn't integrate Android's Audio Focus functionality, as indicated by the lack of Audio Focus-related method calls. Therefore, you aren't able to request permanent audio focus using the framework itself, which would stop audio playback from other active apps.
You can create a Titanium Module that implements this functionality though.
You may have some modest success creating intents for specific applications, for example, sending a pause intent to com.android.music.musicservicecommand, the default music player. See these resources:
android - how to play or resume music of another music player from my code? - Stack Overflow
Android Audio Focus How to » Community Questions & Answers » Appcelerator Developer Center
I've decided to try to make a little Android application that streams live audio from my server. I'm using a HTML5 audio tag for the audio. But, on some devices when the user goes to the browser or their messages the music stops playing. Would I need to create an ongoing notification so the audio would continue to play? Or, would something else be better? I'm using PhoneGap too, I don't know if there's a plug-in out there that I've missed that could solve this. I'm trying to learn all of this on my own, but I'm just confused at this point.
I think it ended up being a problem with the app manager just closing the app.