muxinc / media-chrome

Custom elements (web components) for making audio and video player controls that look great in your website or app.
https://media-chrome.org
MIT License
1.83k stars 76 forks source link

mediavolumeunavailable not added on iOS #1011

Closed luwes closed 1 month ago

luwes commented 1 month ago

this should be added as an attribute if changing volume via software is not available. on most mobile devices.

open https://player-style-e61wlc1tb-mux.vercel.app/themes/halloween on iOS see volume range candle not hiding!

luwes commented 1 month ago

this is a race condition of this test where on heavy websites only after about 80 to 100ms the media.volume property jumps back to its original value.


/**
 * Test for volume support
 *
 * @param mediaEl - The media element to test
 */
export const hasVolumeSupportAsync = async (
  mediaEl: HTMLVideoElement = getTestMediaEl()
): Promise<boolean> => {
  if (!mediaEl) return false;
  const prevVolume = mediaEl.volume;
  mediaEl.volume = prevVolume / 2 + 0.1;
  await delay(0);
  return mediaEl.volume !== prevVolume;
};```