Add a directive to control the playback state of media elements.
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user