amazon-archives / web-app-starter-kit-for-fire-tv

Web App Starter Kit Examples
https://amzn.github.io/web-app-starter-kit-for-fire-tv/
Other
372 stars 161 forks source link

Connecting Youtube API for basic web app starter kit (WASK) ERROR. Unclear source of 'user' in init.js #65

Closed autonomations closed 5 years ago

autonomations commented 5 years ago

My Init.js file that I started with under the projects/youtube tab:

(function(exports) { 'use strict';

var settings = {
    Model: YouTubeAPIModel,
    PlayerView: YouTubePlayerView,
    PlaylistView: PlaylistPlayerView,
    showSearch: false,
    skipLength: 30,
    controlsHideTime: 3000,
    user: "HERE",
    devKey: "HERE",
    channels: [
        {
            type: "playlist",
            id: "HERE",
            title: "Appetizers"
        }
    ],

    displayButtons: false
};

exports.app = new App(settings);

}(window));

Do I put the channel playlist number, do I put my channel number, there are 2 more user id google numbers in the developer console. I have tried many permutations yet always seem to get this back

If I use the user ID from youtube -> advanced settings -> user id And then the dev key from a project with api youtube access from developer google console.

I follow tutorials and video tutorials and get stuck here all day and I can't get past it. It looks like I am not getting the right information back in my JSON request. There is no 'snippet' attribute that I can grab from the JSON request as the requests looks like:

{ "kind": "youtube#channelListResponse", "etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/ewwRz0VbTYpp2EGbOkvZ5M_1mbo\"", "pageInfo": { "totalResults": 0, "resultsPerPage": 5 }, "items": [] }

ERROR when opening index.html or running: serve -p 3000 and going to the localhost webpage

Uncaught TypeError: Cannot read property 'snippet' of undefined at YouTubeAPIModel. (model-youtube-api.js:59) at j (jquery.js:2) at Object.fireWith [as resolveWith] (jquery.js:2) at x (jquery.js:4) at XMLHttpRequest. (jquery.js:4)

When loading index.html I get this:

screen shot 2019-02-27 at 7 11 30 pm
autonomations commented 5 years ago

WHY is this SO unintuitive! This should be so easy!

autonomations commented 5 years ago

The other templates work. I have used the google account user ID but it fails when trying to take information out of the JSON request at

screen shot 2019-02-28 at 10 38 38 am
autonomations commented 5 years ago

Plot thickens. I have one Youtube Premium account that you can get to youtube.com/user/_____ and this WORKS!

But then if I go back to my other Youtube channel I cannot access this same area. It forwards to a channel

autonomations commented 5 years ago

After digging into the Youtube API, needed to change the "forUsername" to "id"