Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70747

Youtube video player

$
0
0

@shchekanenko wrote:

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

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70747

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>