-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No Android support? #10
Comments
It looks dead simple with the new MediaSession class, which is designed to allow you to report media playback to the rest of the system. https://developer.android.com/reference/android/media/session/MediaSession.html Although unfortunately that requires api 21. |
I could use android support as well. Is there any plans to support Android? @ds8k did you end up finding a solution? |
For Android support, you can have a look at cordova-plugin-music-controller. It might however not be perfect... |
Nice @homerours. I haven't tested your code but the api seems similar. Want to merge your project into this one to provide folks with a more complete remote controls plugin? |
Yes, that would be a good solution. But maybe it would be better that you update your JS API to make it easier to understand: use object (instead of arrays) for notifications infoos. Also, why do you fire a DOM event instead of running aa user callback? |
Cool. When you say notification infos, do you mean passing data from js to ios? From examples I've seen, using a array is pretty common. But happy to explore using JSON. I'm down to refactor out the dom event in place of a callback - makes sense. I'll create a branch and add you as a contributor to the project. We'll work off the branch and go from there. Sound good? |
Sounds good. |
Cool I agree. |
created this branch https://github.com/shi11/RemoteControls/tree/androidWindows |
@shi11 @homerours This is fantastic! I've installed this branch on my project and it was easy to integrate into my html5 audio player code. I had been using this for iOS and was excited to see the addition for Android and Windows. I may not be able to help with code commits, but I would love to participate by providing feedback while testing. Is this the best place to provide feedback or should I open new tickets? I'll be testing iOS and Android on a multitude of devices. On android I notice that there is no event called for when a phone call is coming in or some other app plays audio or should interrupt, such as google earth. Is this even possible? Thanks for this! |
@homerours I'm running this branch on android. I found that there is a bug, but I don't know how to fix. I am able to get the code running on android devices that I have for testing which are 4.1.2 and 5.0.2 by commenting out the following starting at line 43 on MusicControls.java:
|
@pvandrunen Thank you very much for this feedback! This fonctions are used to listen to the headset button. It should intercept the click event (that is usually linked to default android music player). |
Thanks for the response. Before uncommenting those lines there was an error When I am back at my desk I will send more details. Phil On Friday, October 23, 2015, homerours notifications@github.com wrote:
Philip Van Drunen |
Please try the code at the original repo. The code I pushed on the android branch is a little bit outdated and may cause bugs. |
any news? is the branch ready to use it or still in development state? It sounds good to see two developers unite their efforts towards community |
Any plans on the Android support? |
Oh cool @Guichaguri yeah that'd be great. I definitely dropped the ball on this but if you wanted to run with it and create a PR that'd be great. |
It's really easy to get it working on Android, but it will need some API changes. Android currently supports: artist, title, album, image, duration, elapsed time, state, volume, speed, buffered position, rating, description, release date, genre, and many other properties Here is what I was thinking: window.remoteControls.updateMetadata({
title: '',
artist: '',
album: '',
cover: '',
duration: 0,
rating: 75,
description: '',
date: '',
genre: ''
});
window.remoteControls.updatePlayback({
elapsedTime: 0,
bufferedTime: 0,
volume: 100,
state: 1, // -1: Error, 0: Stopped, 1: Playing, 2: Paused, 3: Buffering
speed: 1
});
window.remoteControls.updateActions({
play: true,
pause: true,
stop: false,
seekTo: false,
skipToNext: true,
skipToPrevious: true,
rate: true,
volume: true
});
document.addEventListener("remotecontrols", function(event) {
switch(event.action) {
case 'play':
case 'pause':
case 'stop':
// Handle basic controls
break;
case 'volume':
// Handle new volume
//event.volume
break;
case 'seek':
// Handle new playback position
//event.position
break;
case 'next':
case 'previous':
// Handle skipping
break;
case 'rate':
// Handle rating
//event.rating
break;
}
}); I don't know which of them are supported by iOS, I only added the most important properties from Android, and also, most of them are optional. @shi11 What do you think? |
Nice @Guichaguri. I think it looks good. We should research what is supported in iOS. What do other folks think? |
I got it working on Android with the new API. I'll open a PR when I fix and test everything It should work with API 14+ (98.2% of the Android users) |
Done! #32 |
What's happened? Can we get that merged? Be keen to use this for Speaking Email |
Is this just too hard to accomplish on Android? I've been looking all over for an Android version of this plugin and it simply doesn't exist. What's the deal?
The text was updated successfully, but these errors were encountered: