なぜこの関数が機能しないのかわかりません。YouTube API Uncaught TypeError:player.stopVideoが関数ではありません
私はリンクをクリックすると基本的にビデオを停止する私のウェブサイト上で非常に簡単な例を使用しています。
<div id="player"></div>
<a href="#" id="pause">Pause</a>
そして、私はページの一番下に使用していたスクリプトのthats::私は一時停止リンクをクリックすると
var tag = document.createElement('script');
tag.src = "http://www.youtube.com/player_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player;
function onYouTubePlayerAPIReady() {
player = new YT.Player('player', {
height: '315',
width: '560',
videoId: 'bpOR_HuHRNs',
});
document.getElementById('pause').onclick = function() {
player.stopVideo();
};
}
を以下のコードを参照してください。私はGoogleドキュメントからの全コードを実装しようとしてい
Uncaught TypeError: player.stopVideo is not a function
:私はエラーを取得する https://developers.google.com/youtube/iframe_api_reference#Getting_Started
同じproblem..Whatがここに間違っています?
いいえ、それを置き換えようとしましたが、それでも同じエラーです。 – AlwaysConfused