javacript로 시작된 YouTube 재생을 만들려고합니다.Youtube 객체 # <S>에는 'playVideo'메서드가 없습니다.
내가 이런 YouTubePlayer를 시작 : 이후
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('player', {
height: '720',
width: '1280',
html5: 0,
videoId: 'i8IXMGHpGBk',
playerVars: {'modestbranding': 1, 'controls': 1,'showinfo': 0 },
events: {
'onStateChange': function(e) {
if (e.data === 0) {
//skrolla här
}
}
}
});
}
를,이 같은 플레이어를 시작하는 기능을 가지고 :
기능에서 playVideo을() { player.playVideo(); }
플레이어 개체는 문서에 따라이 메서드를 가져야합니다.
는 어떤 이유로, 나는 유튜브 API를 방해 각 가정 오류TypeError: Object #<S> has no method 'playVideo'
at Object.Video.$scope.play (file://localhost/Users/kristoffer.nolgren/web/blossa2013dev/js/main.js:7:10)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:74:98
at https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:156:140
at Object.e.$eval (https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:92:272)
at Object.e.$apply (https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:92:379)
at HTMLDivElement.<anonymous> (https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:156:122)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:24:49
at Array.forEach (native)
at n (https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:6:470)
at HTMLDivElement.c (https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:24:20)
를 얻을,하지만 난 어떻게 understan하지 않습니다.
여기에 플레이어 객체의 첫 번째 수준이다
유튜브 API는 파일 시스템file://
보다는
http://
에서 액세스되는 때문입니다
Y {b: nb, a: iframe#player, i: div#player, id: 1, d: 2…}
a: iframe#player
b: nb
closure_uid_954797855: 1
d: 3
g: O
h: Object
i: div#player
id: 1
k: Object
o: "player"
s: Array[1]
t: false
파일 시스템에서 참조되고 있기 때문일 수 있습니다. –
예, 이것이 이유입니다. –