Interactive Embed

When using the following code from the API docs, I get console errors when embedding the stream into my website. The functionality of the embed works fine but the console is flooded with errors and warnings so I would assume something is not right. A new error is generated every 1 second when the steam is paused as well.

<script src= "http://player.twitch.tv/js/embed/v1.js"></script>
<div id="{PLAYER_DIV_ID}"></div>
<script type="text/javascript">
var options = {
	width: 854,
	height: 480,
	channel: "{CHANNEL}",
	//video: "{VIDEO_ID}"
};
var player = new Twitch.Player("{PLAYER_DIV_ID}", options);
player.setVolume(0.5);
</script>

Could this be happening do to the recent switch to v5? Any help would be appreciated.

Browsers report errors when scripts check for features that don’t exist, which causes some errors from the embedded player to appear in the console, so it’s important to know what errors you’re seeing before we can really say if it’s a problem. Judging by the embed working properly, it’s most likely nothing to worry about.

Here is a screenshot of the errors and warnings:

Here is a screenshot of what happens when the stream is paused:

This is a big problem putting me off using this embed. It makes finding issues while developing our own app very difficult and will result in false error reports from users.

Chrome at least allows you to hide errors originating from certain scripts by right clicking in the console. Not that that’s a good solution to this issue.

The errors while paused can probably be fixed even though they don’t really affect much at all. The ones from the first screenshot…

cast_sender.js will throw an error if chromecast extension isn’t installed. The error is printed by design. The DOMException is from the embed checking if it’s embedded on the Twitch website or somewhere else. The product 404 could technically be “fixed” by returning 200 and checking the contents of the response body instead, but it’s better to use the real response codes IMO.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.