Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…698) * feat(representation): implement video player incl. preview * refactor: format code * refactor(av): better host handler * refactor(representation): clean up code in video components * test(pipe): test time pipe * test(representation): fix and write video tests * refactor(representation): video details * chore(deps): bump js-lib to latest * feat(video): replace moving image file functionality * fix(video): set correct preview position on timeline * style(preview): hide preview on click * refactor(av-timeline): clean up code and add more comments * refactor(video-preview): clean up code and add more comments * refactor(video): clean up code and add more comments * refactor(video): clean up code and add more comments * feat(video): matrix file error handler and code refactoring * fix(video): better calc * refactor(video): clean up code * refactor(video): remove commented code and fix typo * fix(video): update time after replacing video file * fix(representation): replace file only, if data exists
- Loading branch information
1 parent
c77c208
commit 86fc2a7
Showing
30 changed files
with
1,714 additions
and
19 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
8 changes: 8 additions & 0 deletions
8
src/app/main/directive/disable-context-menu.directive.spec.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,8 @@ | ||
import { DisableContextMenuDirective } from './disable-context-menu.directive'; | ||
|
||
describe('DisableContextMenuDirective', () => { | ||
it('should create an instance', () => { | ||
const directive = new DisableContextMenuDirective(); | ||
expect(directive).toBeTruthy(); | ||
}); | ||
}); |
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,17 @@ | ||
import { Directive, HostListener } from '@angular/core'; | ||
|
||
@Directive({ | ||
selector: '[appDisableContextMenu]' | ||
}) | ||
export class DisableContextMenuDirective { | ||
|
||
constructor() { } | ||
|
||
@HostListener('contextmenu', ['$event']) | ||
|
||
onRightClick(event: Event) { | ||
event.preventDefault(); | ||
} | ||
|
||
|
||
} |
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,27 @@ | ||
import { TimePipe } from './time.pipe'; | ||
|
||
describe('TimePipe', () => { | ||
|
||
let pipe = new TimePipe(); | ||
|
||
beforeEach(() => { | ||
pipe = new TimePipe(); | ||
}); | ||
|
||
it('create an instance', () => { | ||
expect(pipe).toBeTruthy(); | ||
}); | ||
|
||
|
||
it('should convert 123 seconds into 2 minutes and 3 seconds', () => { | ||
const seconds = 123; | ||
const time = pipe.transform(seconds); | ||
expect(time).toEqual('02:03'); | ||
}); | ||
|
||
it('should convert 12342 seconds into 3 hours 25 minutes and 42 seconds', () => { | ||
const seconds = 12342; | ||
const time = pipe.transform(seconds); | ||
expect(time).toEqual('03:25:42'); | ||
}); | ||
}); |
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,30 @@ | ||
import { Pipe, PipeTransform } from '@angular/core'; | ||
|
||
/** | ||
* the TimePipe transforms n seconds to hh:mm:ss | ||
* or in case of zero hours to mm:ss | ||
*/ | ||
@Pipe({ | ||
name: 'appTime' | ||
}) | ||
export class TimePipe implements PipeTransform { | ||
|
||
transform(value: number): string { | ||
|
||
const dateObj: Date = new Date(value * 1000); | ||
const hours: number = dateObj.getUTCHours(); | ||
const minutes = dateObj.getUTCMinutes(); | ||
const seconds = dateObj.getSeconds(); | ||
|
||
if (hours === 0) { | ||
return minutes.toString().padStart(2, '0') + ':' + | ||
seconds.toString().padStart(2, '0'); | ||
} else { | ||
return hours.toString().padStart(2, '0') + ':' + | ||
minutes.toString().padStart(2, '0') + ':' + | ||
seconds.toString().padStart(2, '0'); | ||
} | ||
|
||
} | ||
|
||
} |
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
10 changes: 10 additions & 0 deletions
10
src/app/workspace/resource/representation/av-timeline/av-timeline.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,10 @@ | ||
<div class="timeline-wrapper" #timeline> | ||
<div class="progress-wrapper" #progress> | ||
<div class="progress-background"></div> | ||
<div class="progress-buffer"></div> | ||
<div class="progress-fill"></div> | ||
</div> | ||
<div class="thumb" [class.dragging]="dragging" #thumb cdkDragLockAxis="x" cdkDrag | ||
(cdkDragStarted)="toggleDragging()" (cdkDragEnded)="toggleDragging()" (cdkDragMoved)="dragAction($event)" | ||
cdkDragBoundary=".timeline-wrapper"> </div> | ||
</div> |
63 changes: 63 additions & 0 deletions
63
src/app/workspace/resource/representation/av-timeline/av-timeline.component.scss
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,63 @@ | ||
// timeline / progress bar | ||
.timeline-wrapper { | ||
width: calc(100% - 32px); | ||
height: 24px; | ||
top: 0; | ||
position: absolute; | ||
cursor: pointer; | ||
|
||
.progress-wrapper { | ||
width: 100%; | ||
height: 2px; | ||
padding: 11px 0; | ||
position: absolute; | ||
overflow: hidden; | ||
display: flex; | ||
|
||
.progress-background, | ||
// .progress-buffer, | ||
.progress-fill { | ||
height: 2px; | ||
width: 100%; | ||
} | ||
.progress-background { | ||
background-color: whitesmoke; | ||
position: absolute; | ||
transform-origin: 100% 100%; | ||
transition: transform 20ms cubic-bezier(0.25, 0.8, 0.25, 1), | ||
background-color 20ms cubic-bezier(0.25, 0.8, 0.25, 1); | ||
} | ||
|
||
.progress-fill { | ||
background-color: red; | ||
position: absolute; | ||
transform: scaleX(0); | ||
transform-origin: 0 0; | ||
transition: transform 20ms cubic-bezier(0.25, 0.8, 0.25, 1), | ||
background-color 20ms cubic-bezier(0.25, 0.8, 0.25, 1); | ||
} | ||
} | ||
|
||
.thumb { | ||
cursor: grab; | ||
position: absolute; | ||
left: -7px; | ||
bottom: 2px; | ||
box-sizing: border-box; | ||
width: 20px; | ||
height: 20px; | ||
border: 3px solid transparent; | ||
border-radius: 50%; | ||
background-color: red; | ||
transform: scale(0.7); | ||
transition: transform 20ms cubic-bezier(0.25, 0.8, 0.25, 1), | ||
background-color 20ms cubic-bezier(0.25, 0.8, 0.25, 1), | ||
border-color 20ms cubic-bezier(0.25, 0.8, 0.25, 1); | ||
transition: none; | ||
|
||
&.dragging { | ||
cursor: grabbing; | ||
border: 3px solid red; | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/app/workspace/resource/representation/av-timeline/av-timeline.component.spec.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,27 @@ | ||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; | ||
|
||
import { AvTimelineComponent } from './av-timeline.component'; | ||
|
||
describe('AvTimelineComponent', () => { | ||
let component: AvTimelineComponent; | ||
let fixture: ComponentFixture<AvTimelineComponent>; | ||
|
||
beforeEach(waitForAsync(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ | ||
AvTimelineComponent | ||
] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(AvTimelineComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
Oops, something went wrong.