Skip to content

Commit

Permalink
web: On browsers which support it, specify the type of audio Ruffle uses
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhjacobs committed Dec 1, 2024
1 parent c989cc9 commit 718e1e0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions web/packages/core/src/plugin-polyfill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ declare global {
interface MimeTypeArray {
install?: (mimeType: MimeType) => void;
}
interface AudioSession {
type?: string;
}
}

/**
Expand All @@ -244,6 +247,11 @@ declare global {
* @param plugin The plugin to install
*/
export function installPlugin(plugin: RufflePlugin): void {
// This code is not polyfill related, but while messing with the navigator API,
// we can specify https://www.w3.org/TR/audio-session/#audio-session-types
if ("audioSession" in navigator) {
(navigator.audioSession as AudioSession).type = "playback";
}
if (navigator.plugins.namedItem("Shockwave Flash")) {
return;
}
Expand Down

0 comments on commit 718e1e0

Please sign in to comment.