Glitchbone / CordovaYoutubeVideoPlayer

Play Youtube Videos in a native Video Player on Android & iOS
MIT License
83 stars 133 forks source link

Error: self.context.openVideo is not a function #31

Open caike08 opened 7 years ago

caike08 commented 7 years ago

Hello guys,

I've been trying to use this plugin but somehow it isn't working. When I try to call the function "openVideo" it says: self.context.openVideo is not a function. Am I doing something wrong?

HTML:

  <ion-row>
      <ion-col>
        <button ion-button (click)="openVideo('X3z1KF2s8Sc')">
          <ion-icon name="play"></ion-icon>
        </button>
      </ion-col>
    </ion-row>

TS:

  playVideo(videoId) {
    YoutubeVideoPlayer.openVideo(videoId);
  }

Error:

TypeError: self.context.openVideo is not a function
    at DebugAppView.View_LearnPage0.handleEvent_41 (component.ngfactory.js:388)
    at DebugAppView.<anonymous> (view.js:408)
    at HTMLButtonElement.<anonymous> (dom_renderer.js:276)
    at t.invokeTask (polyfills.js:3)
    at Object.onInvokeTask (ng_zone.js:227)
    at t.invokeTask (polyfills.js:3)
    at e.runTask (polyfills.js:3)
    at HTMLButtonElement.invoke (polyfills.js:3)