0.10.16 • Published 5 months ago

ngx-video-timeline v0.10.16

Weekly downloads
8
License
MIT
Repository
github
Last release
5 months ago

NgxVideoTimeline

Demo

example

samplePic

Installation

Compatibility

AngularLatest ngx-video-timeline compatible
170.10.17
160.10.16
150.10.15
140.10.14
130.10.13
120.10.12
110.10.11
100.10.10
90.10.9

Getting Started

npm i ngx-video-timeline --save

or

yarn add ngx-video-timeline

Usage

Import the module into your module

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';
import { NgxVideoTimelineModule } from 'projects/timeline/src/lib/timeline.module';

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule,
        NgxVideoTimelineModule
    ],
    providers: [],
    bootstrap: [AppComponent]
})
export class AppModule { }

then use it in html

<ngx-video-timeline 
    class="canvas"
    [speed]="speed" 
    [playTime]="playTime" 
    [isPlayClick]="isPlayClick" 
    [videoCells]="videoCells" 
    [startTimeThreshold]="startTimeThreshold" 
    [endTimeThreshold]="endTimeThreshold" 
    [canvasHeight]="canvasHeight" 
    (playClick)="onPlayClick($event)"
>
</ngx-video-timeline>

in ts file

import { Component, OnInit } from '@angular/core';
import { VideoCellType } from 'projects/timeline/src/lib/timeline.component';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
    title = 'ngx-video-timeline';

    speed: number;
    canvasHeight: number;
    startTimeThreshold: number;
    endTimeThreshold: number;
    videoCells: VideoCellType[];
    playTime: Date;
    isPlayClick: boolean;

    constructor() {
        this.speed = 10;
        this.isPlayClick = false;
        this.canvasHeight = 80;
        this.startTimeThreshold = new Date().getTime() - 1 * 3600 * 1000;
        this.endTimeThreshold = new Date().getTime() + 1 * 3600 * 1000;
        this.videoCells = [];
        this.playTime = new Date();
    }

    onPlay(): void {

        this.isPlayClick = true;
        this.startTimeThreshold = new Date().getTime() - 1 * 3600 * 1000;
    }

    onPause(): void {

        this.isPlayClick = false;
        // this.endTimeThreshold = new Date().getTime() + 1 * 3600 * 1000;
    }

    onPlayClick(date: number): void {
        // console.log(new Date(date));
        // this.canvasHeight = 60;
    }


    selectedTime(date: any): void {
        this.playTime = date.value;
    }

    changeVideo(): void {
        this.videoCells = [
            {
                beginTime: new Date().getTime() - 1 * 3600 * 1000,
                endTime: new Date().getTime() + 1 * 3600 * 1000,
                style: {
                    background: '#f3e5e4'
                }
            }
        ];
    }

    ngOnInit(): void {
    }
    onDragStart(): void {
        
    }
}

API

NameTypeDefault/ReturnDescription
canvasHeightnumber50Canvas height (not less than 50)
playTimenumber,string,Datenew Date().getTime() - 1 24 3600 * 1000Playback time (default: the previous day)
speednumber1The video plays at twice the speed
forWardValuenumber1Fast forward/fast backward video
startTimeThresholdnumber,string,Datenew Date().getTime() - 1 12 3600 * 1000Left time threshold
endTimeThresholdnumber,string,Datenew Date().getTime() + 1 12 3600 * 1000Right time threshold
videoCellsVideoCellType[]VideoCellType[]Video block (shown in different colors)
borderColorstring"#fff"color of canvas border
bgColorstring"#fff"color of canvas backgraound
bottomLineColorstring"rgba(0,0,0,1)"color of the bottomLine
verticalBarColorstring"rgba(0,0,0,1)"color of the verticalBar
playBarColorstring"#448aff"color of the playBar
(playClick)anyplayTime(Current timestamp)PlayTime starts playing at speed
(mouseUp)anyreturnTime(Current timestamp)Returns the current time when the mouse is released
(mouseDown)anyreturnTime(Current timestamp)Returns the current time when the mouse is pressed

Interfate VideoCellType

fieldnametyperequired/optionaldefault
beginTimeThe start timenumber,stringrequiredundefined
endTimeThe end of timenumber,stringrequiredundefined
styleThe background colorbooleanoptionalVideoCellStyleType

Interfate VideoCellStyleType

fieldnametyperequired/optionaldefault
backgroundThe background colorstringrequiredundefined

#License ngx-video-timeline is licensed under a MIT License.

0.10.16

5 months ago

0.10.17

5 months ago

0.1.16

12 months ago

0.1.10

1 year ago

0.1.11

1 year ago

0.1.12

1 year ago

0.1.15

1 year ago

0.10.9

1 year ago

0.10.14

1 year ago

0.10.15

1 year ago

0.10.10

1 year ago

0.10.11

1 year ago

0.10.12

1 year ago

0.10.13

1 year ago

0.1.2

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.9

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.1

2 years ago

0.1.0

4 years ago

0.0.9

4 years ago

0.0.7

4 years ago

0.0.8

4 years ago

0.0.6

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.1

4 years ago