0.0.2 • Published 1 year ago

mgmg-video-player v0.0.2

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

Mgmg videojs player

This is angular component used as video player .

  • Beautiful and customizable styles
  • Built in one video playing service.

Installation

MgmgVideoPlayer requires Angular v9+ to run.

Install the devDependencies and package.

npm i --save-dev @types/video.js
npm i mgmg-video-player

Import Module.

...
import { MgmgVideoPlayerModule } from 'mgmg-video-player';
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    MgmgVideoPlayerModule,
    BrowserModule,
    AppRoutingModule,
  ],
  ...

Import styles.

@import 'mgmg-video-player/src/lib/mgmg-video-player.css'

You can change the theme color by change css variable called mgmgVidColor

:root{
    --mgmgVidColor: #fff;
}

@import '../../mgmg-video-player/src/lib/mgmg-video-player.css';

Using player.

In HTML:

<mgmg-video-player *ngIf="vidPlayerConf" [options]="vidPlayerConf"></mgmg-video-player>

In TS:

export class AppComponent {
  vidPlayerConf: MgmgVidPlayer = {
    controls: true,
    preload: 'metadata',
    autoplay: true,
    sources: [{
      src: '../assets/vids/vidplayer.mp4',
      type:'video/mp4'
    }]
  }
}

Options

PluginDescription
fluidWhen true, the Video.js player will have a fluid size. In other words, it will scale to fit its container at the video's intrinsic aspect ratio, or at a specified aspectRatio.
aspectRatioPuts the player in fluid mode and the value is used when calculating the dynamic size of the player. The value should represent a ratio - two numbers separated by a colon (e.g. "16:9" or "4:3").
heightSets the display height of the video player in pixels.
widthSets the display width of the video player in pixels.
preloadSuggests to the browser whether or not the video data should begin downloading as soon as the element is loaded. Supported values are: auto Start loading the video immediately (if the browser supports it). Some mobile devices will not preload the video in order to protect their users' bandwidth/data usage. This is why the value is called 'auto' and not something more conclusive like 'true'. metadata default value,Load only the meta data of the video, which includes information like the duration and dimensions of the video. Sometimes, the meta data will be loaded by downloading a few frames of video., none Don't preload any data. The browser will wait until the user hits "play" to begin downloading.
autoplayPlay on load
controlsShow or hide controls, default is true
sourcesvideo paths, It's an array but for this version the first video is just loaded .