In an effort to capture the time at which a user pauses a youtube video (that question posted here), I have found myself using the onYouTubeIframeAPIReady callback method in Angular2.
I am having similar difficulties as outlined here and here.
I followed the advice and ended up using (window as any).onYouTubeIframeAPIReady = function () {}
.
In my onYouTubeIframeAPIReady method, though, I have the following code:
function onYouTubeIframeAPIReady() {
player = new YT.Player('video', {
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
}
I get the following error from my typescript linter:
Argument of type '{events: {'onReady':(event:any) => void; 'onStateChange': (event:any)=>void;};}' is not assignable to parameter of type 'PlayerOptions
My minimal example repo can be found here:
git clone https://github.com/Atticus29/dataJitsu.git
cd dataJitsu
git checkout stackoverflow
npm install
ng serve