Youtube video player

i am trying to play a video from youtube inside my ionic 2 app. any idea why it doesn’t work?

import { Module } from ‘./…/…/models/module’;
import { NavParams, ViewController } from ‘ionic-angular’;
import { Component } from ‘@angular/core’;
import { StreamingMedia, StreamingVideoOptions } from '@ionic-native/streaming-media’
import { YoutubeVideoPlayer } from ‘@ionic-native/youtube-video-player’;

@Component({
selector: ‘page-learning-module’,
templateUrl: ‘learning-module.html’,
})
export class LearningModulePage {

module: Module;
videoUrl: string;
constructor(public navParams: NavParams,
private viewCtrl: ViewController,
private steamingMedia: StreamingMedia,
private youtube: YoutubeVideoPlayer
)
{
this.module = this.navParams.get(‘module’);
}
onLeave() {
this.viewCtrl.dismiss();
}
playVideo() {
this.youtube.openVideo(‘https://www.youtube.com/watch?v=kZirukSP_u0’);
}
}

.html file:


{{ module.id }}





{{ module.description }}


<button ion-button (click)=“playVideo()”>Watch Video
<button ion-button color=“danger” (click)=“onLeave()”>Close

try
playVideo() {
this.youtube.openVideo(‘kZirukSP_u0’);
}

I already tried that but it hasn’t resolved the issue

I have same problem. Works on Android, but can’t get youtube video player to work on iOS no matter what I try. I can’t believe I’m the only one that can’t get this to work on iOS.

same problem here too. does not work on ios

3 Likes

I had the same issue, but in iOS 13. I installed other version, with this:

ionic cordova plugin rm cordova-plugin-youtube-video-player
ionic cordova plugin add https://github.com/KintipsLimited/CordovaYoutubeVideoPlayer.git

And then build:
ionic cordova build ios --prod