Skip to content
This repository has been archived by the owner on Dec 28, 2022. It is now read-only.

how to use it with ionic 5 #77

Open
AnasProgrammer2 opened this issue Mar 29, 2021 · 4 comments
Open

how to use it with ionic 5 #77

AnasProgrammer2 opened this issue Mar 29, 2021 · 4 comments

Comments

@AnasProgrammer2
Copy link

hello , i have app with ionic 5 (anglur 10)
i need how to import plyr to my project

@AnasProgrammer2
Copy link
Author

hello

`import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { TranslateLoader, TranslateModule, TranslatePipe } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { HttpClient, HttpClientModule ,HTTP_INTERCEPTORS } from '@angular/common/http';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { APP_CONFIG, BaseAppConfig } from './app.config';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import {LoaderInterceptor} from './services/loader.interceptor';
import { PlyrModule } from 'ngx-plyr';

export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http);
}
@NgModule({
declarations: [AppComponent],
entryComponents: [],
imports: [
BrowserModule,
MatProgressSpinnerModule,
IonicModule.forRoot(),
AppRoutingModule,
HttpClientModule,
TranslateModule,
PlyrModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient]
}
})
],
providers: [
{ provide: HTTP_INTERCEPTORS, useClass: LoaderInterceptor, multi: true },
{ provide: APP_CONFIG, useValue: BaseAppConfig },
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
],

bootstrap: [AppComponent]
})
export class AppModule {}
`

`

<plyr style="display: block; width: 640px;" plyrTitle="Video 1" [plyrPlaysInline]="true" [plyrSources]="videoSources" (plyrInit)="player = $event" (plyrPlay)="played($event)">

<button (click)="play()">Play

@megasto
Copy link

megasto commented Apr 3, 2021

you should also import inside your module page ex:(home.module.ts) :
import { PlyrModule } from 'ngx-plyr';

 imports: [
  ...
    ,PlyrModule
  ],

in angular.json add the style:

"styles": [
             ...
              {
                "input": "node_modules/plyr/dist/plyr.css"
              }
            ],

@AnasProgrammer2
Copy link
Author

you should also import inside your module page ex:(home.module.ts) :
import { PlyrModule } from 'ngx-plyr';

 imports: [
  ...
    ,PlyrModule
  ],

in angular.json add the style:

"styles": [
             ...
              {
                "input": "node_modules/plyr/dist/plyr.css"
              }
            ],

i don't it , same problem

@megasto
Copy link

megasto commented Apr 3, 2021

@AnasProgrammer2
where is the component page related with :
<plyr style="display: block; width: 640px;" plyrTitle="Video 1" [plyrPlaysInline]="true" [plyrSources]="videoSources" (plyrInit)="player = $event" (plyrPlay)="played($event)">

you should generate another component ex(home.page.ts) , then import plyr.

inside home.page.html :
<plyr style="display: block; width: 640px;" plyrTitle="Video 1" [plyrPlaysInline]="true" [plyrSources]="videoSources" (plyrInit)="player = $event" (plyrPlay)="played($event)">

this issue will help you :
#69

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants