【发布时间】:2019-10-10 08:24:47
【问题描述】:
我一直在使用 YouTube API 在侧边栏上显示播放列表,如 thread 中所述。我在codepen link 中也给出了完整的代码。
但是,IE 无法显示播放列表。以下是控制台错误。
这是触发错误的那一行
function getPlaylistItems(pageToken) {
return gapi.client.youtube.playlistItems.list({
"part": "snippet,contentDetails",
"maxResults": 50,
"playlistId": PLAYLIST_ID,
pageToken //Error is in this line
}).then(function(response) {
const {items, nextPageToken} = response.result;
playlistItems.push(...items);
var index = 0;
items.forEach(function(item) {
const thumbnailItem = createPlaylistItem(item, index);
playlist.appendChild(thumbnailItem);
index++;
});
maxVideoVisible = index - 3;
if (nextPageToken) {
getPlaylistItems(nextPageToken);
}
}, function(err) {
console.error("Execute error", err);
});
}
谁能帮我理解这个问题?
谢谢
【问题讨论】:
-
您使用哪个版本的 IE...因为我不是专业人士但不支持对象解构(我认为)以及 Promises...但也许我错了我只是尝试帮助
-
pageToken键没有值 -
此错误仅在 IE 11 上触发。适用于包括 Microsoft Edge 在内的所有其他浏览器
-
@ThumChoonTat 它不需要有价值。我在问题中添加了完整的功能
-
你需要将你的 nextPageToken 应用到 pageToken: nextPageToken
标签: javascript internet-explorer youtube-api