forked from vime-js/vime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
364 additions
and
25 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
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
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
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,8 @@ | ||
last 1 Chrome version | ||
last 1 Firefox version | ||
last 2 Edge major versions | ||
last 2 Safari major versions | ||
last 2 iOS major versions | ||
Firefox ESR | ||
not IE 9-10 # Angular support for IE 9-10 has been deprecated and will be removed as of Angular v11. To opt-in, remove the 'not' prefix on this line. | ||
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. |
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,61 @@ | ||
<div id="container"> | ||
<vm-player | ||
#player | ||
playsinline | ||
(vPlaybackReady)="onPlaybackReady()" | ||
> | ||
<vm-default-ui> | ||
<!-- Custom UI component. --> | ||
<tap-sides-to-seek></tap-sides-to-seek> | ||
</vm-default-ui> | ||
|
||
<!-- YOUTUBE --> | ||
<!-- <vm-youtube video-id="DyTCOwB0DVw"></vm-youtube> --> | ||
|
||
<!-- VIMEO --> | ||
<!-- <vm-vimeo video-id="411652396"></vm-vimeo> --> | ||
|
||
<!-- DAILYMOTION --> | ||
<!-- <vm-dailymotion video-id="k3b11PemcuTrmWvYe0q"></vm-dailymotion> --> | ||
|
||
<!-- VIDEO --> | ||
<!-- <vm-video cross-origin="anonymous" poster="https://media.vimejs.com/poster.png"> | ||
<source data-src="https://media.vimejs.com/720.mp4" type="video/mp4" /> | ||
<track default kind="subtitles" src="https://media.vimejs.com/subs/english.vtt" srclang="en" label="English" /> | ||
<track kind="subtitles" src="https://media.vimejs.com/subs/spanish.vtt" srclang="es" label="Spanish" /> | ||
</vm-video> --> | ||
|
||
<!-- AUDIO --> | ||
<!-- <vm-audio cross-origin="anonymous"> | ||
<source data-src="https://media.vimejs.com/audio.mp3" type="audio/mp3" /> | ||
</vm-audio> --> | ||
|
||
<!-- HLS --> | ||
<!-- <vm-hls cross-origin="anonymous" poster="https://media.vimejs.com/poster.png"> | ||
<source data-src="https://media.vimejs.com/hls/index.m3u8" type="application/x-mpegURL" /> | ||
</vm-hls> --> | ||
|
||
<!-- DASH --> | ||
<!-- <vm-dash | ||
cross-origin="anonymous" | ||
src="https://media.vimejs.com/mpd/manifest.mpd" | ||
poster="https://media.vimejs.com/poster.png"></vm-dash> --> | ||
</vm-player> | ||
</div> | ||
|
||
<style> | ||
:host { | ||
width: 100%; | ||
height: 100%; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
#container { | ||
width: 100%; | ||
max-width: 960px; | ||
} | ||
</style> | ||
|
||
|
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,15 @@ | ||
import { Component, ViewChild } from '@angular/core'; | ||
import { Player } from '@vime/angular'; | ||
|
||
@Component({ | ||
selector: 'app-root', | ||
templateUrl: './app.component.html', | ||
}) | ||
export class AppComponent { | ||
// Obtain a ref if you need to call any methods. | ||
@ViewChild('player') player!: Player; | ||
|
||
onPlaybackReady() { | ||
// ... | ||
} | ||
} |
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,20 @@ | ||
import { BrowserModule } from '@angular/platform-browser'; | ||
import { NgModule } from '@angular/core'; | ||
import { VimeModule } from '@vime/angular'; | ||
|
||
import { AppComponent } from './app.component'; | ||
import { TapSidesToSeekComponent } from './tap-sides-to-seek/tap-sides-to-seek.component'; | ||
|
||
@NgModule({ | ||
declarations: [ | ||
AppComponent, | ||
TapSidesToSeekComponent, | ||
], | ||
imports: [ | ||
BrowserModule, | ||
VimeModule, | ||
], | ||
providers: [], | ||
bootstrap: [AppComponent], | ||
}) | ||
export class AppModule { } |
32 changes: 32 additions & 0 deletions
32
packages/angular/test/src/app/tap-sides-to-seek/tap-sides-to-seek.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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<div class="tapTarget backward" (click)="onSeekBackward()"></div> | ||
<div class="spacer"></div> | ||
<div class="tapTarget forward" (click)="onSeekForward()"></div> | ||
|
||
<style> | ||
:host { | ||
display: flex; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
/* | ||
Why 21? Simply because it's one index above the `ClickToPlay` component. Click the link | ||
below and scroll down to the `Z-Index` section to see existing levels. | ||
|
||
@see https://github.com/vime-js/vime/blob/master/packages/core/src/globals/themes/default.css | ||
*/ | ||
z-index: 21; | ||
pointer-events: none; | ||
} | ||
|
||
:host > .spacer { | ||
flex: 1; | ||
} | ||
|
||
:host > .tapTarget { | ||
width: 7.5%; | ||
height: 100%; | ||
pointer-events: auto; | ||
} | ||
</style> |
48 changes: 48 additions & 0 deletions
48
packages/angular/test/src/app/tap-sides-to-seek/tap-sides-to-seek.component.ts
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,48 @@ | ||
import { Component, ElementRef } from '@angular/core'; | ||
import { VimeComponent } from '@vime/angular'; | ||
|
||
@Component({ | ||
selector: 'tap-sides-to-seek', | ||
templateUrl: './tap-sides-to-seek.component.html', | ||
}) | ||
export class TapSidesToSeekComponent extends VimeComponent { | ||
currentTime = 0; | ||
|
||
duration = -1; | ||
|
||
/** | ||
* When we extend the `Component` class a few things are happening under the hood. | ||
* | ||
* 1. The super constructor overwrites all player properties with fresh getters/setters. Not all | ||
* properties contain setters (readonly), so it's best to refer to the documentation. | ||
* 2. The component binds itself to the player context so that player properties are updated as | ||
* they change. | ||
* 3. The component will dispatch any updates to the player if a writable player prop is changed. | ||
* 4. When the component is destroyed, it will automatically unbind itself from the player. | ||
* | ||
* IMPORTANT: The `ElementRef` is required as the `Component` class uses it to dispatch | ||
* custom events to the player. Angular automatically injects this value. | ||
* | ||
* @see https://vimejs.com/components/core/player/api | ||
*/ | ||
constructor(protected ref: ElementRef) { | ||
// Pass in the properties you'd like to bind to this component. | ||
super([ | ||
'currentTime', | ||
'duration', | ||
]); | ||
|
||
// There is a player ref if you need to call any methods. | ||
// this.player | ||
} | ||
|
||
onSeekBackward() { | ||
if (this.currentTime < 5) return; | ||
this.currentTime -= 5; | ||
} | ||
|
||
onSeekForward() { | ||
if (this.currentTime > (this.duration - 5)) return; | ||
this.currentTime += 5; | ||
} | ||
} |
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,3 @@ | ||
export const environment = { | ||
production: true, | ||
}; |
Oops, something went wrong.