Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
verona-modules-aspect
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IQB
verona-modules-aspect
Commits
7abdb348
Commit
7abdb348
authored
3 years ago
by
jojohoch
Browse files
Options
Downloads
Patches
Plain Diff
Refactor timeouts and aspect-player detection in control bar
parent
9a520ab6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
projects/common/element-components/control-bar/control-bar.component.ts
+12
-9
12 additions, 9 deletions
...n/element-components/control-bar/control-bar.component.ts
with
12 additions
and
9 deletions
projects/common/element-components/control-bar/control-bar.component.ts
+
12
−
9
View file @
7abdb348
import
{
Component
,
EventEmitter
,
Input
,
OnDestroy
,
OnInit
,
Output
OnInit
,
AfterContentInit
,
OnDestroy
,
Component
,
EventEmitter
,
Input
,
Output
}
from
'
@angular/core
'
;
import
{
MatSliderChange
}
from
'
@angular/material/slider
'
;
import
{
AudioElement
}
from
'
../../models/audio-element
'
;
...
...
@@ -11,7 +11,7 @@ import { ValueChangeElement } from '../../models/uI-element';
templateUrl
:
'
./control-bar.component.html
'
,
styleUrls
:
[
'
./control-bar.component.css
'
]
})
export
class
ControlBarComponent
implements
OnInit
,
OnDestroy
{
export
class
ControlBarComponent
implements
OnInit
,
AfterContentInit
,
OnDestroy
{
@
Input
()
player
!
:
HTMLVideoElement
|
HTMLAudioElement
;
@
Input
()
elementModel
!
:
AudioElement
|
VideoElement
;
@
Output
()
playbackTimeChanged
=
new
EventEmitter
<
ValueChangeElement
>
();
...
...
@@ -36,7 +36,6 @@ export class ControlBarComponent implements OnInit, OnDestroy {
// minRuns: number; // 1
ngOnInit
():
void
{
this
.
checkEnvironment
();
// Firefox has problems to get the duration
this
.
player
.
ondurationchange
=
()
=>
this
.
initTimeValues
();
this
.
player
.
ontimeupdate
=
()
=>
{
...
...
@@ -66,6 +65,10 @@ export class ControlBarComponent implements OnInit, OnDestroy {
this
.
player
.
muted
=
!
this
.
player
.
volume
;
};
this
.
lastVolume
=
this
.
player
.
volume
;
}
ngAfterContentInit
():
void
{
this
.
isAspectPlayer
=
!!
this
.
player
.
closest
(
'
player-aspect
'
);
if
(
this
.
isAspectPlayer
)
{
this
.
initAutostart
();
this
.
initHint
();
...
...
@@ -109,10 +112,6 @@ export class ControlBarComponent implements OnInit, OnDestroy {
event
.
preventDefault
();
}
private
checkEnvironment
()
{
this
.
isAspectPlayer
=
!!
this
.
player
.
closest
(
'
player-aspect
'
);
}
private
checkStatus
(
runCounter
:
number
):
boolean
{
this
.
disabled
=
!
this
.
elementModel
.
maxRuns
?
false
:
this
.
elementModel
.
maxRuns
<=
runCounter
;
return
this
.
disabled
;
...
...
@@ -121,7 +120,9 @@ export class ControlBarComponent implements OnInit, OnDestroy {
private
initAutostart
():
void
{
if
(
this
.
elementModel
.
autostart
&&
!
this
.
started
)
{
setTimeout
(()
=>
{
this
.
_play
();
if
(
!
this
.
started
)
{
this
.
_play
();
}
},
this
.
elementModel
.
autostartDelay
);
}
}
...
...
@@ -129,7 +130,9 @@ export class ControlBarComponent implements OnInit, OnDestroy {
private
initHint
():
void
{
if
(
this
.
elementModel
.
hintLabel
&&
!
this
.
started
)
{
setTimeout
(()
=>
{
this
.
showHint
=
true
;
if
(
!
this
.
started
)
{
this
.
showHint
=
true
;
}
},
this
.
elementModel
.
hintLabelDelay
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment