@Morbakos wrote:
Hello,
I’m trying to use the “streaming-media” component from “@ionic-native/streaming-media”, according to this page, but when I try to use it, the video didn’t start.
Here are the code:
App.module.ts
import { NgModule, ErrorHandler } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular'; import { MyApp } from './app.component'; import { StreamingMedia } from '@ionic-native/streaming-media'; import { AboutPage } from '../pages/about/about'; import { ContactPage } from '../pages/contact/contact'; import { HomePage } from '../pages/home/home'; import { TabsPage } from '../pages/tabs/tabs'; import { ConnexionPage } from '../pages/connexion/connexion'; import { FormConnexionPage } from '../pages/form-connexion/form-connexion'; import { FormInscriptionPage } from '../pages/form-inscription/form-inscription'; import { StatusBar } from '@ionic-native/status-bar'; import { SplashScreen } from '@ionic-native/splash-screen'; @NgModule({ declarations: [ MyApp, AboutPage, ContactPage, HomePage, TabsPage, ConnexionPage, FormConnexionPage, FormInscriptionPage ], imports: [ BrowserModule, IonicModule.forRoot(MyApp) ], bootstrap: [IonicApp], entryComponents: [ MyApp, AboutPage, ContactPage, HomePage, TabsPage, ConnexionPage, FormConnexionPage, FormInscriptionPage ], providers: [ StatusBar, SplashScreen, StreamingMedia, {provide: ErrorHandler, useClass: IonicErrorHandler} ] }) export class AppModule {}about.ts
import { Component } from '@angular/core'; import { NavController } from 'ionic-angular'; import { StreamingMedia, StreamingVideoOptions } from '@ionic-native/streaming-media'; @Component({ selector: 'page-about', templateUrl: 'about.html' }) export class AboutPage { constructor(public navCtrl: NavController, private streamingMedia: StreamingMedia) { } let options: StreamingVideoOptions = { successCallback: () => { console.log('Video played') }, errorCallback: (e) => { console.log('Error streaming') }, orientation: 'landscape', shouldAutoClose: true, controls: false }; this.streamingMedia.playVideo('https://www.youtube.com/watch?v=xC2s4HAWoXA', options); }Does anyone have any ideas?
Thank you
Posts: 1
Participants: 1