mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Add a directive to control the playback state of media elements.
This commit is contained in:
parent
d137b00822
commit
1263532271
2 changed files with 17 additions and 0 deletions
16
services/web/public/coffee/directives/videoPlayState.coffee
Normal file
16
services/web/public/coffee/directives/videoPlayState.coffee
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
define [
|
||||||
|
"base"
|
||||||
|
], (App) ->
|
||||||
|
App.directive "videoPlayState", ($parse) ->
|
||||||
|
return {
|
||||||
|
restrict: "A",
|
||||||
|
link: (scope, element, attrs) ->
|
||||||
|
videoDOMEl = element[0]
|
||||||
|
console.dir videoDOMEl
|
||||||
|
scope.$watch (() -> $parse(attrs.videoPlayState)(scope)), (shouldPlay) ->
|
||||||
|
if shouldPlay
|
||||||
|
videoDOMEl.currentTime = 0
|
||||||
|
videoDOMEl.play()
|
||||||
|
else
|
||||||
|
videoDOMEl.pause()
|
||||||
|
}
|
|
@ -29,6 +29,7 @@ define [
|
||||||
"directives/stopPropagation"
|
"directives/stopPropagation"
|
||||||
"directives/rightClick"
|
"directives/rightClick"
|
||||||
"directives/expandableTextArea"
|
"directives/expandableTextArea"
|
||||||
|
"directives/videoPlayState"
|
||||||
"services/queued-http"
|
"services/queued-http"
|
||||||
"filters/formatDate"
|
"filters/formatDate"
|
||||||
"main/event"
|
"main/event"
|
||||||
|
|
Loading…
Reference in a new issue