I am looking for a working example of Videogular 2 running on Ionic 2, or even a flat Angular 2 environment.
I have tried many different online examples, and it looks like the documents are out of date or completely inaccurate.
For example, the documents clearly state that a base player can be created using:
<videogular vg-theme="config.theme"> <vg-media vg-src="config.sources" vg-tracks="config.tracks"> </vg-media> <vg-overlay-play></vg-overlay-play> </videogular>
What I load in Typescript:
import { VgAPI } from 'videogular2/core'; import { VgCoreModule } from 'videogular2/core'; import { VgControlsModule } from 'videogular2/controls'; import { VgOverlayPlayModule } from 'videogular2/overlay-play';
This gives me an error:
Error: Uncaught (in promise): Error: Template parse errors: 'vg-media' is not a known element
I have little success using vg-player and not videogular and then the video tag. It works, but just gives me a native player. Any attempt to use the Videogular tags inside it will give me a similar error above.
All components are also present in my app.module.ts file in the imports .
My full controller:
import { Component } from '@angular/core'; import { NavController, NavParams, ToastController, LoadingController } from 'ionic-angular'; import { VgAPI } from 'videogular2/core'; import { VgCoreModule } from 'videogular2/core'; import { VgControlsModule } from 'videogular2/controls'; import { VgOverlayPlayModule } from 'videogular2/overlay-play'; import { Level } from '../../providers/level'; @Component({ selector: 'page-programme-overview', templateUrl: 'programme_overview.html' }) export class ProgrammeOverviewPage { api: VgAPI; videos: any; config: any; constructor( public navCtrl: NavController, public toastCtrl: ToastController, private navParams: NavParams) { this.videos = [ { sources: [ {src: "http://static.videogular.com/assets/videos/videogular.mp4", type: "video/mp4"}, {src: "http://static.videogular.com/assets/videos/videogular.webm", type: "video/webm"}, {src: "http://static.videogular.com/assets/videos/videogular.ogg", type: "video/ogg"} ] }, { sources: [ {src: "http://static.videogular.com/assets/videos/big_buck_bunny_720p_h264.mov", type: "video/mp4"}, {src: "http://static.videogular.com/assets/videos/big_buck_bunny_720p_stereo.ogg", type: "video/ogg"} ] } ]; this.config = { preload: "none", autoHide: false, autoHideTime: 3000, autoPlay: false, sources: this.videos[0].sources, theme: { url: "https://unpkg.com/ videogular@2.1.2 /dist/themes/default/videogular.css" }, plugins: { poster: "http://www.videogular.com/assets/images/videogular.png" } }; }
And my full HTML:
<ion-header> <ion-navbar> <ion-title>Video</ion-title> </ion-navbar> </ion-header> <ion-content> <videogular vg-theme="config.theme"> <vg-media vg-src="config.sources" vg-tracks="config.tracks"> </vg-media> <vg-overlay-play></vg-overlay-play> </videogular> </ion-content>
Any help is appreciated. I am currently considering other options for the video, but would like to stick with Videogular as this seems like a great solution if I can get it working.