mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-23 13:41:48 +00: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/rightClick"
|
||||
"directives/expandableTextArea"
|
||||
"directives/videoPlayState"
|
||||
"services/queued-http"
|
||||
"filters/formatDate"
|
||||
"main/event"
|
||||
|
|
Loading…
Reference in a new issue