Skip to content

Instantly share code, notes, and snippets.

@snipem
Created March 20, 2024 08:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snipem/cab5280f823647ccbcd63a4ec7c911cd to your computer and use it in GitHub Desktop.
Save snipem/cab5280f823647ccbcd63a4ec7c911cd to your computer and use it in GitHub Desktop.
Userscript KHInsider Autoplay
// ==UserScript==
// @name KHInsider Autoplay
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Autoplays Soundtracks from KHInsider
// @author You
// @match https://downloads.khinsider.com/game-soundtracks/album/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=khinsider.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
window.addEventListener('load', function() {
console.log("Attempting Autoplay");
document.getElementsByTagName("audio")[0].play();
}, false);
})();
@snipem
Copy link
Author

snipem commented Mar 20, 2024

You might have to enable audio autoplay for certain websites in your browser settings

This error was produced in my case: Unhandled Promise Rejection: NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment