I just paste code from documentation
<iframe
src="https://player.twitch.tv/?video=v${videoID}"
height="720"
width="1280"
frameborder="0"
scrolling="no"
allowfullscreen="true">
</iframe>
And I get next error Error fetching VOD previews:
Response -> type: “cors” -> url: "https://api.twitch.tv/kraken/videos/v${videoID}"
-> status 400
Probably, I need to return clientID, but how I can do it in my iframe? Documentation talk about this nothing! How I can resolve this problem?
You need to replace this with the ID of the video you want to display
You didn’t specify which video you wanted
Hmm… It’s instance for you. Actualy request:
<iframe
src="https://player.twitch.tv/?video=v33811521232"
height="720"
width="1280"
frameborder="0"
scrolling="no"
allowfullscreen="true">
</iframe>
And problem actual for me.
There is no Video identified by the ID 33811521232
Can’t display as VOD that doesn’t exist!
{
"data": [
{
"id": "28623425344",
"user_id": "150573462",
.....
} ]
}
Documentation return ID and I use it. Is it not video ID? How I can get video ID from API?
What API call is that data from?
Which video are you trying to get?
You have linked the Streams API
Are you trying to Embed a stream or a VOD?
Your original post suggests a VOD (prerecoded video)
You have liked to the Stream API which suggests you are trying to embed a stream (live video)
Yes. I try get stream (live video). Can I do it by embed?
<html>
<body>
<!-- Add a placeholder for the Twitch embed -->
<div id="twitch-embed"></div>
<!-- Load the Twitch embed script -->
<script src="https://embed.twitch.tv/embed/v1.js"></script>
<!-- Create a Twitch.Embed object that will render within the "twitch-embed" root element. -->
<script type="text/javascript">
new Twitch.Embed("twitch-embed", {
width: 854,
height: 480,
channel: "monstercat"
});
</script>
</body>
</html>
OR
<iframe
src="https://player.twitch.tv/?channel=monstercat"
height="<height>"
width="<width>"
frameborder="<frameborder>"
scrolling="<scrolling>"
allowfullscreen="<allowfullscreen>">
</iframe>
No. I want use video ID, no channel
To Embed a LIVE STREAM you MUST call via Channel Name.
A Live Stream does not have a Video ID
Ok) Thanks. How I can get channel name from API?
In order to look up a channel in the API you either need the UserID or the channelName
So then you already have the channelName.
So the question is what data do you have? In order to perform an API lookup?
Thanks) I try to get user_name and check your advise for me! 
What parameters are you using when calling that endpoint?
That endpoint returns a user_name
key which is what you pass to the embed examples to embed/display the livestream.
user_name
string Login name corresponding to user_id
. Then user_id
it a user_name
too. And is it channel name??
user_name
and channel name
are two names for the same thing.
A user_name
has a user_id
Use the user_name
in the channel embed to embed the stream.
Yes
No they cannot be used interchangably
user_name is the channel_name
user_id is the user_id
system
Closed
19
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.