You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/10/24 14:01:01 UTC

[GitHub] [cordova-plugin-media] spinninghamster opened a new issue #295: If the "Media" volume is lowered or muted while the sound is playing - how to put it back to 100% programatically?

spinninghamster opened a new issue #295:
URL: https://github.com/apache/cordova-plugin-media/issues/295


   I noticed that if you lower the sound on the device or even lower it until its muted, the "Media" stream stays muted. There's no way to turn it back up except when another sound is playing. Which is very bad if it's a ringtone for an alert or something, because the user has no way to put it back up except when catching it right when the ringtone plays. Is there any fix for that?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-media] spinninghamster commented on issue #295: If the "Media" volume is lowered or muted while the sound is playing - how to put it back to 100% programatically?

Posted by GitBox <gi...@apache.org>.
spinninghamster commented on issue #295:
URL: https://github.com/apache/cordova-plugin-media/issues/295#issuecomment-718092679


   > Thanks a lot for your issue, however this channel is for bug and feature requests, not for support. 😊
   > You can try asking on [StackOverflow](https://stackoverflow.com/questions/tagged/cordova) or in our [Slack community](http://slack.cordova.io).
   
   It's kind of a bug, no? Imagine a 5 second ringtone and someone lowers the "MEDIA" channel while the ringtone is playing. There is no way to put it back up unless you catch the "MEDIA" channel again exactly when the sound is playing. And you don't know when the sound is playing because you cannot hear it. It basically renders the plugin useless.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-media] spinninghamster edited a comment on issue #295: If the "Media" volume is lowered or muted while the sound is playing - how to put it back to 100% programatically?

Posted by GitBox <gi...@apache.org>.
spinninghamster edited a comment on issue #295:
URL: https://github.com/apache/cordova-plugin-media/issues/295#issuecomment-718092679


   > Thanks a lot for your issue, however this channel is for bug and feature requests, not for support. 😊
   > You can try asking on [StackOverflow](https://stackoverflow.com/questions/tagged/cordova) or in our [Slack community](http://slack.cordova.io).
   
   It's kind of a bug, no? Imagine a 5 second ringtone and someone lowers the "MEDIA" channel while the ringtone is playing. There is no way to put it back up unless you catch the "MEDIA" channel again exactly when the sound is playing. And you don't know when the sound is playing because you cannot hear it. It basically renders the plugin useless.
   
   `myMedia.setVolume('1.0');` does not work in this case.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-media] timbru31 commented on issue #295: If the "Media" volume is lowered or muted while the sound is playing - how to put it back to 100% programatically?

Posted by GitBox <gi...@apache.org>.
timbru31 commented on issue #295:
URL: https://github.com/apache/cordova-plugin-media/issues/295#issuecomment-716413881


   Thanks a lot for your issue, however this channel is for bug and feature requests, not for support. 😊  
   You can try asking on [StackOverflow](https://stackoverflow.com/questions/tagged/cordova) or in our [Slack community](http://slack.cordova.io).


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-media] breautek commented on issue #295: If the "Media" volume is lowered or muted while the sound is playing - how to put it back to 100% programatically?

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #295:
URL: https://github.com/apache/cordova-plugin-media/issues/295#issuecomment-718115563


   > It's kind of a bug, no?
   
   I don't think this is a bug. If it was, you should follow the bug form provided when you create the issue.
   
   But the reason why I don't think this is a bug is users expect that volume is controlled via the hardware buttons of the device, or through the OS audio volume interface (where for example, android has several different audio streams that the user can control each one independently). Generally speaking of course. In my experience, in-app volume controls are always relative to the OS/hardware volume configuration. In my opinion, apps that break this rule are incredibly annoying.
   
   > Imagine a 5 second ringtone and someone lowers the "MEDIA" channel while the ringtone is playing.
   
   I'd expect the media channel volume will stay at the volume that I set it to until I change it otherwise.
   
   In other words, picture these scenarios:
   
   OS Volume 100%
   App Volume 100%
   App produces audio at its loudest setting
   
   OS Volume 100%
   App Volume 0%
   App produces no audio, however other apps may still produce audio.
   
   OS Volume 0%
   App Volume 100%
   App produces no volume because 100% of 0 is 0. And this is probably want the user wants if they have their OS volume setting to 0%.
   
   This follows the effective media volume as defined in the [W3C Living Specification](https://html.spec.whatwg.org/multipage/media.html#effective-media-volume).
   
   Specifically:
   >Return volume, interpreted relative to the range 0.0 to 1.0, with 0.0 being silent, and 1.0 being the loudest setting, values in between increasing in loudness. The range need not be linear. The loudest setting may be lower than the system's loudest possible setting; for example the user could have set a maximum volume. 
   
   Cordova aims to bring a consistent web technologies stack in the form of hybrid apps. So providing APIs that breaks a defined specification is generally outside of Apache's scope. But Android does have APIs through the [AudioManager](https://developer.android.com/reference/android/media/AudioManager) class to forcefully change each audio stream volume, which sounds like what you want. I'm not familiar with iOS SDK at all so I can only assume iOS has an equivalent API. Research would be required if you intend to support iOS. 
   
   I would encourage you to rethink about volume control in your app, and if you decide that forcefully controlling the OS volume is necessary for your app, then you are right. This plugin won't be sufficient for your use case, and you'll either find a more robust plugin that uses the advanced APIs provided by the platform SDKs or roll your own plugin that does so.
   
   Hope this helps you understand the reason why the volume behaves the way it does and potential solutions to your specific use case.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-media] timbru31 closed issue #295: If the "Media" volume is lowered or muted while the sound is playing - how to put it back to 100% programatically?

Posted by GitBox <gi...@apache.org>.
timbru31 closed issue #295:
URL: https://github.com/apache/cordova-plugin-media/issues/295


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-media] spinninghamster commented on issue #295: If the "Media" volume is lowered or muted while the sound is playing - how to put it back to 100% programatically?

Posted by GitBox <gi...@apache.org>.
spinninghamster commented on issue #295:
URL: https://github.com/apache/cordova-plugin-media/issues/295#issuecomment-718122429


   @breautek Thank you for your detailed explanation. We do actually use it on Android only at the moment. It does appear to be a "grey area" with that problem.
   
   We're certainly not trying to "dictate" the volume of the app to the user, however we are also facing the issue where the device volume is 100% but the "MEDIA" channel is lowered or muted by the user because they think they are temporarily lowering the sound or muting it. Later when they increase the device sound again, it's at 100% for all other apps but for this app it's muted and they then contact us and ask us why they're not receiving sound notifications anymore. We tell them to put the sound to 100% and they do that.
   
   We even went "on-location" to the devices and found that the device is at 100% volume but only when the notification sound of the app is playing, the "MEDIA" stream is muted because they lowered the sound right when that notification sound was playing and were not able to put it back up or thought it was already back up.
   
   It's difficult to explain to some users that there is a device sound volume and a "MEDIA" volume for the app. But I understand how it works and why it works that way, it's just frustrating and causing problems for us and we don't see any easy way to fix it.
   
   We did find this piece of code in CordovaActivity.java:
   
   ```
   // Wire the hardware volume controls to control media if desired.
           String volumePref = preferences.getString("DefaultVolumeStream", "");
           if ("media".equals(volumePref.toLowerCase(Locale.ENGLISH))) {
               setVolumeControlStream(AudioManager.STREAM_MUSIC);
           }
   ```
   
   And tried commenting it out to disable changing the MEDIA volume with buttons. We also tried to change the channels in all locations of the code from STREAM_MEDIA to STREAM_MUSIC or even STREAM_NOTIFICATION (in fact, we tried all of them) and never got it working.
   
   Again, I understand why it works that way but maybe in the future you could give some thought on how to fix it in case the user thinks the sound is at 100% when adjusting the volume when a notification is not playing, only to find out they don't receive sound notifications because the media channel is muted.
   
   In the meantime, I will keep looking for a solution and update here if I find it :)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-media] breautek commented on issue #295: If the "Media" volume is lowered or muted while the sound is playing - how to put it back to 100% programatically?

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #295:
URL: https://github.com/apache/cordova-plugin-media/issues/295#issuecomment-718131238


   I'm not so certain that code snippet is actually used.
   
   https://github.com/apache/cordova-plugin-media/blob/a10c6d025fe7b663032db09463293a10738c7575/src/android/AudioPlayer.java#L573-L580
   
   This plugin's `AudioPlayer` class uses [MediaPlayer](https://developer.android.com/reference/android/media/MediaPlayer?hl=en#setVolume(float,%20float)) APIs, not the `AudioManager` apis. I'm not an expert in this area but I think `MediaPlayer` is a simplistic API that covers most use cases, but it's not robust, whereas the `AudioManager`, with some limitations, has full control over audio volumes.
   
   Forking this plugin and replace `MediaPlayer` usages with `AudioManager`, at least for volume control is probably your solution.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org