ngx-plyr icon indicating copy to clipboard operation
ngx-plyr copied to clipboard

how to use it with ionic 5

Open AnasProgrammer2 opened this issue 4 years ago • 4 comments

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

AnasProgrammer2 avatar Mar 29 '21 18:03 AnasProgrammer2

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

AnasProgrammer2 avatar Apr 02 '21 09:04 AnasProgrammer2

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"
              }
            ],

megasto avatar Apr 03 '21 15:04 megasto

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

AnasProgrammer2 avatar Apr 03 '21 19:04 AnasProgrammer2

@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 : https://github.com/smnbbrv/ngx-plyr/issues/69

megasto avatar Apr 03 '21 20:04 megasto