Skip to content

Commit

Permalink
feat(API): Added currentTime
Browse files Browse the repository at this point in the history
Added currentTime to API. Improved examples with bound player. Improved code styling.
  • Loading branch information
Elecash committed Feb 12, 2016
1 parent fa66d64 commit 68ee704
Show file tree
Hide file tree
Showing 22 changed files with 254 additions and 32 deletions.
2 changes: 2 additions & 0 deletions examples/build/app.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/build/app.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 61 additions & 0 deletions examples/build/bound-player.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/build/bound-player.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions examples/build/multiple-media-player.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/build/multiple-media-player.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions examples/build/simple-player.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/build/simple-player.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions examples/build/single-media-player.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/build/single-media-player.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ <h1>Videogular 2 Example</h1>
<li><a [routerLink]="['SingleMediaPlayer']">Single Media Player</a></li>
<li><a [routerLink]="['MultipleMediaPlayer']">Multiple Media Player</a></li>
<li><a [routerLink]="['AudioPlayer']">Audio Player</a></li>
<li><a [routerLink]="['BoundPlayer']">Bound Player</a></li>
</ul>
</nav>
</aside>
Expand Down
2 changes: 2 additions & 0 deletions examples/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {bootstrap} from 'angular2/platform/browser';
import {SingleMediaPlayer} from "./single-media-player";
import {MultipleMediaPlayer} from "./multiple-media-player";
import {AudioPlayer} from "./audio-player";
import {BoundPlayer} from "./bound-player";

@Component({
selector: 'vg-demo',
Expand Down Expand Up @@ -85,6 +86,7 @@ import {AudioPlayer} from "./audio-player";
{path: '/single-media-player', name: 'SingleMediaPlayer', component: SingleMediaPlayer, useAsDefault: true},
{path: '/multiple-media-player', name: 'MultipleMediaPlayer', component: MultipleMediaPlayer},
{path: '/audio-player', name: 'AudioPlayer', component: AudioPlayer},
{path: '/bound-player', name: 'BoundPlayer', component: BoundPlayer},
{path: '/**', redirectTo: ['SingleMediaPlayer']}
])
export class VgDemo {
Expand Down
43 changes: 43 additions & 0 deletions examples/src/bound-player.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<h2>Video player with bindings</h2>

<p>Video player with bound properties.</p>

<vg-player (onPlayerReady)="onPlayerReady($event)">
<vg-overlay-play></vg-overlay-play>

<vg-controls *ngIf="!controls">
<vg-play-pause></vg-play-pause>
<vg-playback-button></vg-playback-button>

<vg-time-display>{{ media?.time?.current | date:'mm:ss' }}</vg-time-display>

<vg-scrub-bar>
<vg-scrub-bar-current-time></vg-scrub-bar-current-time>
<vg-scrub-bar-buffering-time></vg-scrub-bar-buffering-time>
</vg-scrub-bar>

<vg-time-display>{{ media?.time?.left | date:'mm:ss' }}</vg-time-display>
<vg-time-display>{{ media?.time?.total | date:'mm:ss' }}</vg-time-display>

<vg-mute></vg-mute>

<vg-fullscreen></vg-fullscreen>
</vg-controls>

<video #media id="singleVideo" preload="auto" [controls]="controls">
<source *ngFor="#video of sources" [src]="video.src" [type]="video.type">
</video>
</vg-player>

<div>
<button type="button" (click)="api.play()">Play</button>
<button type="button" (click)="api.pause()">Pause</button>
<button type="button" (click)="api.currentTime = 50">Seek to second 50</button>
</div>
<div>
<label for="nativeControls">Native Controls</label>
<input #nativeControls id="nativeControls" type="checkbox" (change)="controls = nativeControls.checked">
</div>
<div>
<label>{{ 'Current time: ' + api?.time?.current}}</label>
</div>
51 changes: 51 additions & 0 deletions examples/src/bound-player.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import {Component} from 'angular2/core';
import {NgFor, NgIf} from 'angular2/common';
import {VgAPI, VgPlayer, VgOverlayPlay, VgControls, VgPlayPause, VgPlaybackButton, VgScrubBar, VgScrubBarCurrentTime, VgScrubBarBufferingTime, VgMute, VgFullscreen} from 'videogular2/videogular2';

@Component({
selector: 'vg-demo',
templateUrl: './src/bound-player.html',
directives: [
VgPlayer,
VgOverlayPlay,
VgControls,
VgPlayPause,
VgPlaybackButton,
VgScrubBar,
VgScrubBarCurrentTime,
VgScrubBarBufferingTime,
VgMute,
VgFullscreen,
NgFor,
NgIf
]
})
export class BoundPlayer {
sources:Array<Object>;
controls:boolean = false;
autoplay:boolean = false;
loop:boolean = false;
preload:string = 'auto';
api:VgAPI;

constructor() {
this.sources = [
{
src: "http://static.videogular.com/assets/videos/videogular.mp4",
type: "video/mp4"
},
{
src: "http://static.videogular.com/assets/videos/videogular.ogg",
type: "video/ogg"
},
{
src: "http://static.videogular.com/assets/videos/videogular.webm",
type: "video/webm"
}
];
}

onPlayerReady(api:VgAPI) {
this.api = api;
}
}
4 changes: 0 additions & 4 deletions examples/src/multiple-media-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ import {VgPlayer, VgOverlayPlay, VgControls, VgPlayPause, VgPlaybackButton, VgSc
})
export class MultipleMediaPlayer {
sources:Array<Object>;
controls:boolean = false;
autoplay:boolean = false;
loop:boolean = false;
preload:string = 'auto';

constructor() {
this.sources = [
Expand Down
11 changes: 11 additions & 0 deletions examples/src/simple-player.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<h2>Simple Video Player</h2>

<p>Video player with one video object, without plugins and static sources.</p>

<vg-player>
<video id="singleVideo" preload="auto" controls>
<source src="http://static.videogular.com/assets/videos/videogular.mp4" type="video/mp4">
<source src="http://static.videogular.com/assets/videos/videogular.ogg" type="video/ogg">
<source src="http://static.videogular.com/assets/videos/videogular.webm" type="video/webm">
</video>
</vg-player>
11 changes: 11 additions & 0 deletions examples/src/simple-player.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {Component} from 'angular2/core';
import {VgPlayer} from 'videogular2/videogular2';

@Component({
selector: 'simple-player',
templateUrl: './src/simple-player.html',
directives: [
VgPlayer
]
})
export class SimplePlayer {}
Loading

0 comments on commit 68ee704

Please sign in to comment.