I want to get the video and display video image. Once user clicks on it should play through native youtube video player
my home.ts
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams,Platform } from 'ionic-angular';
import { YoutubeVideoPlayer } from '@ionic-native/youtube-video-player';
import { Title } from '@angular/platform-browser';
import { YtProvider } from './../../providers/yt/yt';
import { Observable } from 'rxjs/Observable';
@IonicPage()
@Component({
selector: 'page-homee',
templateUrl: 'homee.html',
})
export class HomeePage {
public video: any=[];
public title:any;
constructor(public navCtrl: NavController, public navParams: NavParams,private youtube: YoutubeVideoPlayer,private ytProvider: YtProvider, private plt: Platform) {
this.video=this.youtube.openVideo('xxxxxxxxx');//video ID
}
ionViewDidLoad() {
debugger;
if (this.plt.is('cordova')) {
this.youtube.openVideo(this.video);
} else {
window.open('https://www.youtube.com/watch?v=' + this.video);
}
console.log("video");
}
}`
and home.html
<img [src]="videos.snippet.thumbnails.standard.url"> </ion-thumbnail> <h2>{{ videos.snippet.title }}</h2> <p>{{ videos.snippet.description }}</p>
but it showiing error
TypeError: Cannot read property ‘snippet’ of undefined