Cannot invoke method (X) on NullVideoAPI

Currently getting the following errors:

Cannot invoke method setVolume on NullVideoAPI
Cannot invoke method setMuted on NullVideoAPI

Did something change recently?

This is what I have been using

player.setVolume(0.5);
player.setMuted(true);

Here is what the embed test page looks like:

Not getting any errors from the function calls, but it looks like there is an issue setting the volume property. Here’s the error it’s throwing:
https://i.gyazo.com/750d0f9f008c5d77e39d24b7db2794bc.png

<html>
  <body onload="setPlayer()">
	<script src= "http://player.twitch.tv/js/embed/v1.js"></script>
	<div id="player"></div>
	<script type="text/javascript">
		var options = {
			width: 1020,
			height: 760,
			channel: "cohhcarnage"
		};
		var player = new Twitch.Player("player", options);
		
		function setPlayer(){
			player.setMuted(true);
			player.setVolume(0.1);
			player.setQuality("360p");
		}
	</script>
  </body>
</html>

@TZionic the code you pasted never runs the functions…

@twitter_accounts try using the functions on the ready event instead. As it stands, you’re attempting to set the volume/mute/quality before the player has been loaded in.

Wait, they’re running for me. On first load, it’s still too fast though.I’ll check out the ready state.

So the example on the https://dev.twitch.tv/docs/v5/guides/embed-video/#interactive-frames-for-live-streams-and-vods section is wrong?

I tried using the ready event in the documentation, but it was still having the same problems. The play event, however, seems to do the trick. The cog wheel for the quality never stops spinning for me. Not sure what that means. Here’s the complete code I’ve got:

<html>
  <body>
	<script src= "http://player.twitch.tv/js/embed/v1.js"></script>
	<div id="player"></div>
	<script type="text/javascript">
		var options = {
			width: 1020,
			height: 760,
			channel: "cohhcarnage",
		};
		var player=new Twitch.Player("player", options);
		
		player.addEventListener("play", function(){
			console.log("player is ready.......");
			player.setQuality("360p");
			player.setMuted(true);
			player.setVolume(0.1);
		});
		
	</script>
  </body>
</html>

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