Goal: Get an embedded player working in OBS as a browser source.
Problem: After making the necessary updates to my HTML file (iframe embed), the embedded player still does not play successfully in OBS as a browser source. When OBS tries to load the stream, it just shows a spinning wheel.
My Setup: I have a local webserver (IIS) running two different HTML files, neither of which work successfully. One HTML file is the iframe-based embedded player. The other is the javascript-based embedded player. I have a browser source in OBS loading the URL “http://localhost/iframeplayer.html”. When OBS tries to load the browser source, it just shows a spinning wheel indicating that the stream is trying to load.
From what inspection I’ve been able to do, it does not look like OBS is able to successfully fetch the stream itself even though it’s able to load the embedded player, although I could definitely be wrong here.
Any ideas on how to fix this, or is this something that has to be addressed by the embedded player team and/or the OBS developers?
Here is the code for the iframe player I’m using:
<html>
<body>
<iframe
src="https://player.twitch.tv/?channel=CloneKorp&parent=localhost"
width="1920"
height="1080"
frameborder="0"
scrolling="no"
preload="auto"
autoplay="true"
muted="true"
allowfullscreen="true">
</iframe>
</body>
</html>
I can successfully load the webpage and see the embedded stream if I open the webpage with FireFox or Chrome. OBS does not load the stream successfully though.
I found that one could attach to OBS via a websocket connection through Chrome DevTools, and this is what I’m seeing in the logs:
Here’s the output in the Chrome DevTools console:
Access to fetch at 'https://static.twitchcdn.net/assets/wasmworker.min-cd4a9d9….wasm' from origin 'https://player.twitch.tv' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
wasmworker.min-baf151b….js:1 wasm streaming compile failed: TypeError: Failed to fetch
wasmworker.min-baf151b….js:1 falling back to ArrayBuffer instantiation
Access to fetch at 'https://static.twitchcdn.net/assets/wasmworker.min-cd4a9d9….wasm' from origin 'https://player.twitch.tv' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
http?channel=CloneKorp&parent=localhost:1 Access to fetch at 'https://static.twitchcdn.net/assets/wasmworker.min-cd4a9d9….wasm' from origin 'https://player.twitch.tv' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
chrome-extension://invalid/:1 Failed to load resource: net::ERR_FAILED
wasmworker.min-baf151b….js:1 Access to XMLHttpRequest at 'https://static.twitchcdn.net/assets/wasmworker.min-cd4a9d9….wasm' from origin 'https://player.twitch.tv' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
chrome-extension://invalid/:1 Failed to load resource: net::ERR_FAILED
wasmworker.min-baf151b….js:1 DOMException: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'https://static.twitchcdn.net/assets/wasmworker.min-cd4a9d9….wasm'.
at Object.n.readBinary (https://static.twitchcdn.net/assets/wasmworker.min-baf151b….js:1:17129)
at $ (https://static.twitchcdn.net/assets/wasmworker.min-baf151b….js:1:21257)
at https://static.twitchcdn.net/assets/wasmworker.min-baf151b….js:1:21791
wasmworker.min-baf151b….js:1 DOMException: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'https://static.twitchcdn.net/assets/wasmworker.min-cd4a9d9….wasm'.
at Object.n.readBinary (https://static.twitchcdn.net/assets/wasmworker.min-baf151b….js:1:17129)
at $ (https://static.twitchcdn.net/assets/wasmworker.min-baf151b….js:1:21257)
at https://static.twitchcdn.net/assets/wasmworker.min-baf151b….js:1:21791
wasmworker.min-baf151b….js:1 failed to asynchronously prepare wasm: abort({"stack":"Error: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'https://static.twitchcdn.net/assets/wasmworker.min-cd4a9d9….wasm'.\n at Object.n.readBinary (https://static.twitchcdn.net/assets/wasmworker.min-baf151b….js:1:17129)\n at $ (https://static.twitchcdn.net/assets/wasmworker.min-baf151b….js:1:21257)\n at https://static.twitchcdn.net/assets/wasmworker.min-baf151b….js:1:21791"}). Build with -s ASSERTIONS=1 for more info.
wasmworker.min-baf151b….js:1 abort({"stack":"Error: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'https://static.twitchcdn.net/assets/wasmworker.min-cd4a9d9….wasm'.\n at Object.n.readBinary (https://static.twitchcdn.net/assets/wasmworker.min-baf151b….js:1:17129)\n at $ (https://static.twitchcdn.net/assets/wasmworker.min-baf151b….js:1:21257)\n at https://static.twitchcdn.net/assets/wasmworker.min-baf151b….js:1:21791"}). Build with -s ASSERTIONS=1 for more info.
wasmworker.min-baf151b….js:1 abort({"stack":"Error: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'https://static.twitchcdn.net/assets/wasmworker.min-cd4a9d9….wasm'.\n at Object.n.readBinary (https://static.twitchcdn.net/assets/wasmworker.min-baf151b….js:1:17129)\n at $ (https://static.twitchcdn.net/assets/wasmworker.min-baf151b….js:1:21257)\n at https://static.twitchcdn.net/assets/wasmworker.min-baf151b….js:1:21791"}). Build with -s ASSERTIONS=1 for more info.
847a9fc9-c121-4f56-8403-79fbe2de1437:1 Uncaught (in promise) abort("abort({\"stack\":\"Error: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'https://static.twitchcdn.net/assets/wasmworker.min-cd4a9d9….wasm'.\\n at Object.n.readBinary (https://static.twitchcdn.net/assets/wasmworker.min-baf151b….js:1:17129)\\n at $ (https://static.twitchcdn.net/assets/wasmworker.min-baf151b….js:1:21257)\\n at https://static.twitchcdn.net/assets/wasmworker.min-baf151b….js:1:21791\"}). Build with -s ASSERTIONS=1 for more info."). Build with -s ASSERTIONS=1 for more info.