I am building a video sharing app with ionic. I want when users wants to upload videos and it will give them a preview where they can trim the video, now I found the Cordova plugin that can do it, but I don't knowhow to use it Here is the plugin
cordova-plugin-video-trim
from https://www.npmjs.com/package/cordova-plugin-video-trim
Now please, how can I use this plugin in my ionic application
Go to the project root and run these commands:
cordova plugin add cordova-plugin-video-trim
Then run:
npm i cordova-plugin-video-trim
Then open your app.module.ts and import it and put it in providers:
import {YourPlugin} from './path-to-your-plugin-in-node_modules';
@NgModule({
...
providers: [
...
YourPlugin
...
],
...
})
export class AppModule {
}
and now you can import it in your component controller (.page.ts file) and make an instance of it in the constructor and use its methods:
import {YourPlugin} from './path-to-your-plugin-in-node_modules';
@Component({
selector: 'app-somepage',
templateUrl: './somepage.page.html',
styleUrls: ['./somepage.page.scss'],
})
export class SomepagePage implements OnInit, AfterViewInit {
constructor(private plugin: YourPlugin) {
}
}