Twitch android integration problem

I am using Webview to load the video. The webview is connect to javascript and html, which is a interactive embed player.

However, I got these error:

Uncaught (in promise) undefined

invalid operation: t.channel is not implemented
value @ player.42430df….js:8
api.twitch.tv/api/viewer/token.json Failed to load resource: the server responded with a status of 401 ()
player.42430df….js:8 Invalid operation: t.channel is not implemented
value @ player.42430df….js:8
api.twitch.tv/kraken/user Failed to load resource: the server responded with a status of 401 ()

The error says it’s unauthorized. It’s wired to authorized a embedded video.

My code is like this:

var options = {
		width : '100%',
		height : '100%',
	};
    
player = new Twitch.Player("player", options);
player.setVideo(id.toString());

Do u guys have any ideas?

Another question, Do we need to do auth for android embedded video?

Set the video ID in the options, if possible, or on the ready event. Auth is not required; the 401s tell the player it’s not a logged in user so it doesn’t enable additional functionality it has for logged in users.

Thx for your reply!

I try to setVideo when player is ready, and I got the error like this:

readyState: 4, responseText: “{“error”:“Not Found”,“status”:404,“message”:“Video does not exist”}”, responseJSON: Object, status: 404, statusText: “error”

The video id I do here is 149444544, it should absolutely works. Do u have any ideas with this?

Is necessary to convert int to string?

Video IDs always start with v (possibly some starting with c), they cannot be integers.

Thx! It works.

However, the video player does not have a control of the progress or volume control in the bottom. Do u know how to show that? I try with option like:

var options = {
		width : '100%',
		height : '100%',
		control : true,
		autoplay : true
	};

But it doest work.

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