-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #263 from e-picsa/ft-video-playback
(video-player) Playback service and storage
- Loading branch information
Showing
7 changed files
with
327 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import * as schema from './schema_v0'; | ||
|
||
// Re-export schema to provide latest version without need to refactor additonal code | ||
|
||
export const COLLECTION = schema.COLLECTION_V0; | ||
export type IVideoPlayerEntry = schema.IVideoPlayerEntry_V0; | ||
export const SCHEMA = schema.SCHEMA_V0; | ||
|
||
// Ensure blank templates always recreated from scratch | ||
export const ENTRY_TEMPLATE = schema.ENTRY_TEMPLATE_V0; | ||
|
||
export const COLLECTION_NAME = 'video_player'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { RxJsonSchema } from 'rxdb'; | ||
|
||
import type { IPicsaCollectionCreator } from '../../../services/core/db_v2/models/index'; | ||
|
||
const SCHEMA_VERSION = 0; | ||
|
||
export interface IVideoPlayerEntry_V0 { | ||
videoId: string; | ||
currentTime: number; | ||
totalTime: number; | ||
playbackPercentage: number; | ||
} | ||
|
||
export const ENTRY_TEMPLATE_V0: (videoId: string) => IVideoPlayerEntry_V0 = (videoId) => ({ | ||
videoId, | ||
currentTime: 0, | ||
totalTime: 0, | ||
playbackPercentage: 0, | ||
}); | ||
|
||
export const SCHEMA_V0: RxJsonSchema<IVideoPlayerEntry_V0> = { | ||
title: 'video playback schema', | ||
version: SCHEMA_VERSION, | ||
type: 'object', | ||
primaryKey: 'videoId', | ||
properties: { | ||
videoId: { | ||
type: 'string', | ||
}, | ||
currentTime: { | ||
type: 'number', | ||
}, | ||
totalTime: { | ||
type: 'number', | ||
}, | ||
playbackPercentage: { | ||
type: 'number', | ||
}, | ||
}, | ||
required: ['videoId', 'currentTime', 'totalTime', 'playbackPercentage'], | ||
}; | ||
|
||
export const COLLECTION_V0: IPicsaCollectionCreator<IVideoPlayerEntry_V0> = { | ||
schema: SCHEMA_V0, | ||
isUserCollection: true, | ||
}; |
22 changes: 17 additions & 5 deletions
22
libs/shared/src/features/video-player/video-player.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
<div class="placeholder" [id]="playerId" #playerEl slot="fixed"> | ||
<div *ngIf="thumbnail" class="thumbnail" [style.background-image]="'url(' + thumbnail + ')'"></div> | ||
<button *ngIf="showPlayButton" mat-fab color="primary" class="play-button" (click)="playVideo()" [disabled]="!source"> | ||
<mat-icon>play_arrow</mat-icon> | ||
</button> | ||
<div class="placeholderContainer"> | ||
<div class="placeholder" [id]="playerId" #playerEl slot="fixed"> | ||
<div *ngIf="thumbnail" class="thumbnail" [style.background-image]="'url(' + thumbnail + ')'"></div> | ||
<button | ||
*ngIf="showPlayButton" | ||
mat-fab | ||
color="primary" | ||
class="play-button" | ||
(click)="playVideo()" | ||
[disabled]="!source" | ||
> | ||
<mat-icon>play_arrow</mat-icon> | ||
</button> | ||
</div> | ||
<div *ngIf="playbackPercentage > 0 && showPlayButton" class="progress-bar"> | ||
<mat-progress-bar mode="determinate" [value]="playbackPercentage"></mat-progress-bar> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.