Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
aa85499b
Commit
aa85499b
authored
Jun 25, 2012
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup Video Logger, update logging message
parent
034b0868
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
6 deletions
+28
-6
lms/static/coffee/spec/modules/video/video_player_spec.coffee
+4
-4
lms/static/coffee/spec/modules/video_spec.coffee
+15
-0
lms/static/coffee/src/modules/video.coffee
+7
-0
lms/static/coffee/src/modules/video/video_player.coffee
+2
-2
No files found.
lms/static/coffee/spec/modules/video/video_player_spec.coffee
View file @
aa85499b
...
@@ -144,7 +144,7 @@ describe 'VideoPlayer', ->
...
@@ -144,7 +144,7 @@ describe 'VideoPlayer', ->
beforeEach
->
beforeEach
->
@
anotherPlayer
=
jasmine
.
createSpyObj
'AnotherPlayer'
,
[
'pauseVideo'
]
@
anotherPlayer
=
jasmine
.
createSpyObj
'AnotherPlayer'
,
[
'pauseVideo'
]
window
.
player
=
@
anotherPlayer
window
.
player
=
@
anotherPlayer
spyOn
Logger
,
'log'
spyOn
@
video
,
'log'
spyOn
(
window
,
'setInterval'
).
andReturn
100
spyOn
(
window
,
'setInterval'
).
andReturn
100
spyOn
@
player
.
control
,
'play'
spyOn
@
player
.
control
,
'play'
@
player
.
caption
.
play
=
jasmine
.
createSpy
(
'VideoCaption.play'
)
@
player
.
caption
.
play
=
jasmine
.
createSpy
(
'VideoCaption.play'
)
...
@@ -153,7 +153,7 @@ describe 'VideoPlayer', ->
...
@@ -153,7 +153,7 @@ describe 'VideoPlayer', ->
@
player
.
onStateChange
data
:
YT
.
PlayerState
.
PLAYING
@
player
.
onStateChange
data
:
YT
.
PlayerState
.
PLAYING
it
'log the play_video event'
,
->
it
'log the play_video event'
,
->
expect
(
Logger
.
log
).
toHaveBeenCalledWith
'play_video'
,
id
:
@
player
.
currentTime
,
code
:
'embedCode'
expect
(
@
video
.
log
).
toHaveBeenCalledWith
'play_video'
,
id
:
@
player
.
currentTime
,
code
:
'embedCode'
it
'pause other video player'
,
->
it
'pause other video player'
,
->
expect
(
@
anotherPlayer
.
pauseVideo
).
toHaveBeenCalled
()
expect
(
@
anotherPlayer
.
pauseVideo
).
toHaveBeenCalled
()
...
@@ -178,7 +178,7 @@ describe 'VideoPlayer', ->
...
@@ -178,7 +178,7 @@ describe 'VideoPlayer', ->
beforeEach
->
beforeEach
->
@
player
=
new
VideoPlayer
video
:
@
video
@
player
=
new
VideoPlayer
video
:
@
video
window
.
player
=
@
player
.
player
window
.
player
=
@
player
.
player
spyOn
Logger
,
'log'
spyOn
@
video
,
'log'
spyOn
window
,
'clearInterval'
spyOn
window
,
'clearInterval'
spyOn
@
player
.
control
,
'pause'
spyOn
@
player
.
control
,
'pause'
@
player
.
caption
.
pause
=
jasmine
.
createSpy
(
'VideoCaption.pause'
)
@
player
.
caption
.
pause
=
jasmine
.
createSpy
(
'VideoCaption.pause'
)
...
@@ -187,7 +187,7 @@ describe 'VideoPlayer', ->
...
@@ -187,7 +187,7 @@ describe 'VideoPlayer', ->
@
player
.
onStateChange
data
:
YT
.
PlayerState
.
PAUSED
@
player
.
onStateChange
data
:
YT
.
PlayerState
.
PAUSED
it
'log the pause_video event'
,
->
it
'log the pause_video event'
,
->
expect
(
Logger
.
log
).
toHaveBeenCalledWith
'pause_video'
,
id
:
@
player
.
currentTime
,
code
:
'embedCode
'
expect
(
@
video
.
log
).
toHaveBeenCalledWith
'pause_video
'
it
'set current video player as inactive'
,
->
it
'set current video player as inactive'
,
->
expect
(
window
.
player
).
toBeNull
()
expect
(
window
.
player
).
toBeNull
()
...
...
lms/static/coffee/spec/modules/video_spec.coffee
View file @
aa85499b
...
@@ -128,3 +128,18 @@ describe 'Video', ->
...
@@ -128,3 +128,18 @@ describe 'Video', ->
it
'return duration for current video'
,
->
it
'return duration for current video'
,
->
expect
(
@
video
.
getDuration
()).
toEqual
200
expect
(
@
video
.
getDuration
()).
toEqual
200
describe
'log'
,
->
beforeEach
->
@
video
=
new
Video
'example'
,
'.75:abc123,1.0:def456'
@
video
.
setSpeed
'1.0'
spyOn
Logger
,
'log'
@
video
.
player
=
{
currentTime
:
25
}
@
video
.
log
'someEvent'
it
'call the logger with valid parameters'
,
->
expect
(
Logger
.
log
).
toHaveBeenCalledWith
'someEvent'
,
id
:
'example'
code
:
'def456'
currentTime
:
25
speed
:
'1.0'
lms/static/coffee/src/modules/video.coffee
View file @
aa85499b
...
@@ -45,3 +45,10 @@ class @Video
...
@@ -45,3 +45,10 @@ class @Video
getDuration
:
->
getDuration
:
->
@
metadata
[
@
youtubeId
()].
duration
@
metadata
[
@
youtubeId
()].
duration
log
:
(
eventName
)
->
Logger
.
log
eventName
,
id
:
@
id
code
:
@
youtubeId
()
currentTime
:
@
player
.
currentTime
speed
:
@
speed
lms/static/coffee/src/modules/video/video_player.coffee
View file @
aa85499b
...
@@ -68,7 +68,7 @@ class @VideoPlayer extends Subview
...
@@ -68,7 +68,7 @@ class @VideoPlayer extends Subview
@
caption
.
pause
()
@
caption
.
pause
()
onPlay
:
=>
onPlay
:
=>
Logger
.
log
'play_video'
,
id
:
@
currentTime
,
code
:
@
player
.
getVideoEmbedCode
()
@
video
.
log
'play_video'
window
.
player
.
pauseVideo
()
if
window
.
player
&&
window
.
player
!=
@
player
window
.
player
.
pauseVideo
()
if
window
.
player
&&
window
.
player
!=
@
player
window
.
player
=
@
player
window
.
player
=
@
player
unless
@
player
.
interval
unless
@
player
.
interval
...
@@ -78,7 +78,7 @@ class @VideoPlayer extends Subview
...
@@ -78,7 +78,7 @@ class @VideoPlayer extends Subview
@
progressSlider
.
play
()
@
progressSlider
.
play
()
onPause
:
=>
onPause
:
=>
Logger
.
log
'pause_video'
,
id
:
@
currentTime
,
code
:
@
player
.
getVideoEmbedCode
()
@
video
.
log
'pause_video'
window
.
player
=
null
if
window
.
player
==
@
player
window
.
player
=
null
if
window
.
player
==
@
player
clearInterval
(
@
player
.
interval
)
clearInterval
(
@
player
.
interval
)
@
player
.
interval
=
null
@
player
.
interval
=
null
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment