Skip to content
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 can not be decoded since 1.36.1 #78333

Closed
Malacath-92 opened this issue Aug 1, 2019 · 4 comments
Closed

Audio can not be decoded since 1.36.1 #78333

Malacath-92 opened this issue Aug 1, 2019 · 4 comments
Assignees
Labels
upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@Malacath-92
Copy link

Short: The function AudioContext.decodeAudioData() fails in 1.36.1 but not in 1.35.1, given the same data.

  • VSCode Version: 1.36.1-user and 1.37.0-insider
  • OS Version: Windows 10

Steps to Reproduce:

  1. Create extension with the following source:
import * as vscode from 'vscode';

let webviewPanel = vscode.window.createWebviewPanel(
    'extension_name',
    'Webview Name',
    vscode.ViewColumn.Two,
    {
        enableScripts: true
    }
);

export function activate(extensionContext: vscode.ExtensionContext) {
    let resourcePath = "vscode-resource:/path_to_some.mp3";

    webviewPanel.webview.html = `
<script type="text/javascript">
    const AudioContext = window.AudioContext || window.webkitAudioContext;
    const audioContext = new AudioContext();
    audioContext.resume();

    fetch('${resourcePath}')
        .then(response => {
            return response.arrayBuffer();
        })
        .then(buffer => {
            audioContext.decodeAudioData(buffer)
                .then(audioBuffer => {
                    let audio = audioContext.createBufferSource();
                    audio.buffer = audioBuffer;
                    audio.loop = true;

                    let analyser = audioContext.createAnalyser();
                    analyser.fftSize = 512;

                    audio.connect(analyser);
                    analyser.connect(audioContext.destination);
                    audio.start();
                })
                .catch(e => {
                    console.error("Error: " + e.message);
                });
        }).
        catch(e => {
            console.error("Error: " + e.message);
        });

    render();

    function render() {
        requestAnimationFrame(render);
    }
</script>
    `;
}
export function deactivate() {
    webviewPanel.dispose();
}
  1. When the extension is activated, a webview panel will load, which will report VM98:25 Error: Unable to decode audio data in the Webview Developer Tools. Also the following warning is reported: VM98:3 The Web Audio autoplay policy will be re-enabled in Chrome 70 (October 2018). Please check that your website is compatible with it. https://goo.gl/7K7WLu
  2. No audio plays.
  3. Compare with behavior of same extension in 1.35.1, where no warning or error is reported and audio plays.
@gjsjohnmurray
Copy link
Contributor

Maybe a consequence of 1.36 being the first release using Chrome 69. On 1.35 you had Chrome 66.

The current Exploration build is piloting Electron 6 and gives you Chrome 76. See #76069

@Malacath-92
Copy link
Author

@gjsjohnmurray I tried the exploration build and indeed it works again. For which version is Electron 6 targeted, so I can have a rough estimate as to when the feature will work again.

@gjsjohnmurray
Copy link
Contributor

I don't know what the planned schedule is. Electron 6,0.0 released two days ago and VSCode exploration builds using 6.0.0 appeared yesterday. Just beware that if you install that build and then check for updates you'll get downgraded to a build dated 2019-07-13.

Once #78131 is done (next week?) and 1.37 ships it'll be interesting to see if #75802 gets merged and appears in 1.38.0-insider.

@mjbvz
Copy link
Collaborator

mjbvz commented Aug 11, 2019

Closing as upstream electron issue fixed by 6.0

@mjbvz mjbvz closed this as completed Aug 11, 2019
@mjbvz mjbvz added electron-6.0.x-update upstream Issue identified as 'upstream' component related (exists outside of VS Code) labels Aug 11, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Sep 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

4 participants