-
-
Notifications
You must be signed in to change notification settings - Fork 429
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
Audio autoplay / add set audio volume level to kvmd api #1201
Comments
Hello. It's not possible because this is a browser limitation. Browsers do not allow us to play video and audio automatically, only muted video. As you noted, it is allowed after user interaction, but this heuristic is very unreliable and has not always worked. |
Are you referring to the Media Engagement Index in chrome's autoplay policy? I've had a good experience using audio autoplay code for displaying go2rtc webrtc camera streams from home assistant in javascript using Chrome. I believe it is still true that autoplay is still allowed when the user has interacted with the domain (click, tap, etc.). I've used a one-time mouse click/key up event listener to the document to unmute the video player.
or
to call
I did use a custom media element play method to prevent Chrome from pausing the media stream when unmute play isn't allowed
autoplay always works after the first mouse click or keypress. Maybe a hotkey? |
Hard refresh then destroys the permission. I personally would still very much like to attempt to unmute with a single click. In my code, I've used a mute icon overlay when unmuted play fails to provide a visual indication that audio is not enabled |
If there is a way to call the javascript ui from the kvmd api, then the entire DOM can be searched for the media element and the above code can be worked in |
Yes. And my testing has shown that it does not work well. Since you have a positive experience, you can offer a quick PR (maybe a dirty proof of concept) to show how it should work. The sound is turned on here: https://github.com/pikvm/kvmd/blob/master/web/share/js/kvm/stream.js |
Note that KVMD API can't affect UI. |
Sup? |
Dirty and untested:
|
Thank you, I'll try. |
Is your feature request related to a problem? Please describe:
pikvm sessions always start with client audio disabled
Describe the solution you'd like:
Ability to enable audio by default and change the setting from an kvmd api call
Chrome browser allows audio autoplay after user interaction. Requesting the ability to start session with client audio enabled and/or enable audio and set the volume level from kvmd
e.g.
api_set_url="https://127.0.0.1/api/streamer/set_params?audio="
post_response=$(curl -s -X POST -k -u "$USERNAME:$PASSWORD" "$API_SET_URL$new_value")
Describe alternatives you've considered:
Directly calling the embedded Janus websocket
Additional context:
I rely on audio notifications from one of my pcs. When using pikvm, I first switch the input channel using a GPIO menu command and then manually make a couple more mouse clicks to enable audio. Since I'm switching to the PC using a mouse click on a GPIO menu item in the browser, I've satisficed the requirement to automatically play audio using WebRTC in Chrome and the additional mouse clicks are technically unnecessary and could be added to my GPIO menu input script
The text was updated successfully, but these errors were encountered: