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
0815f349
Commit
0815f349
authored
Jun 25, 2012
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup Video Logger, update logging message
parent
8fb06ce1
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 @
0815f349
...
...
@@ -144,7 +144,7 @@ describe 'VideoPlayer', ->
beforeEach
->
@
anotherPlayer
=
jasmine
.
createSpyObj
'AnotherPlayer'
,
[
'pauseVideo'
]
window
.
player
=
@
anotherPlayer
spyOn
Logger
,
'log'
spyOn
@
video
,
'log'
spyOn
(
window
,
'setInterval'
).
andReturn
100
spyOn
@
player
.
control
,
'play'
@
player
.
caption
.
play
=
jasmine
.
createSpy
(
'VideoCaption.play'
)
...
...
@@ -153,7 +153,7 @@ describe 'VideoPlayer', ->
@
player
.
onStateChange
data
:
YT
.
PlayerState
.
PLAYING
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'
,
->
expect
(
@
anotherPlayer
.
pauseVideo
).
toHaveBeenCalled
()
...
...
@@ -178,7 +178,7 @@ describe 'VideoPlayer', ->
beforeEach
->
@
player
=
new
VideoPlayer
video
:
@
video
window
.
player
=
@
player
.
player
spyOn
Logger
,
'log'
spyOn
@
video
,
'log'
spyOn
window
,
'clearInterval'
spyOn
@
player
.
control
,
'pause'
@
player
.
caption
.
pause
=
jasmine
.
createSpy
(
'VideoCaption.pause'
)
...
...
@@ -187,7 +187,7 @@ describe 'VideoPlayer', ->
@
player
.
onStateChange
data
:
YT
.
PlayerState
.
PAUSED
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'
,
->
expect
(
window
.
player
).
toBeNull
()
...
...
lms/static/coffee/spec/modules/video_spec.coffee
View file @
0815f349
...
...
@@ -128,3 +128,18 @@ describe 'Video', ->
it
'return duration for current video'
,
->
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 @
0815f349
...
...
@@ -45,3 +45,10 @@ class @Video
getDuration
:
->
@
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 @
0815f349
...
...
@@ -68,7 +68,7 @@ class @VideoPlayer extends Subview
@
caption
.
pause
()
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
=
@
player
unless
@
player
.
interval
...
...
@@ -78,7 +78,7 @@ class @VideoPlayer extends Subview
@
progressSlider
.
play
()
onPause
:
=>
Logger
.
log
'pause_video'
,
id
:
@
currentTime
,
code
:
@
player
.
getVideoEmbedCode
()
@
video
.
log
'pause_video'
window
.
player
=
null
if
window
.
player
==
@
player
clearInterval
(
@
player
.
interval
)
@
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