Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xblock-officemix
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
OpenEdx
xblock-officemix
Commits
602e0435
Commit
602e0435
authored
Nov 20, 2015
by
Kurt Berglund
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add in a slide change event. Update event data based on eventing review
parent
fc09b3a9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
10 deletions
+45
-10
officemix/static/js/officemix_view.js
+45
-10
No files found.
officemix/static/js/officemix_view.js
View file @
602e0435
...
@@ -5,23 +5,47 @@ function OfficeMixBlock(runtime, element) {
...
@@ -5,23 +5,47 @@ function OfficeMixBlock(runtime, element) {
var
mixUrl
=
iframe
.
attr
(
'src'
);
var
mixUrl
=
iframe
.
attr
(
'src'
);
var
eventUrl
=
runtime
.
handlerUrl
(
element
,
'publish_event'
);
var
eventUrl
=
runtime
.
handlerUrl
(
element
,
'publish_event'
);
/**
* The API returns slides in a 0-based format. Add one to convert into a more human readable format
*/
function
convertSlideIndex
(
slide
)
{
return
slide
+
1
;
}
/**
* Retrieves the current time and slide from the playing Office Mix
*/
function
getCurrentTimeAndSlide
(
callback
)
{
player
.
getCurrentTime
(
function
(
currentTime
)
{
player
.
send
({
method
:
'getCurrentPage'
},
function
(
currentSlide
)
{
callback
(
currentTime
,
convertSlideIndex
(
currentSlide
));
});
});
}
player
.
on
(
'ready'
,
function
()
{
player
.
on
(
'ready'
,
function
()
{
player
.
getDuration
(
function
(
duration
)
{
player
.
getDuration
(
function
(
duration
)
{
var
data
=
{
player
.
send
({
method
:
'getPageCount'
},
function
(
totalSlides
)
{
'event_type'
:
'microsoft.office.mix.loaded'
,
var
data
=
{
url
:
mixUrl
,
'event_type'
:
'microsoft.office.mix.loaded'
,
duration
:
duration
url
:
mixUrl
,
};
duration
:
duration
,
totalSlides
:
totalSlides
};
$
.
post
(
eventUrl
,
JSON
.
stringify
(
data
));
$
.
post
(
eventUrl
,
JSON
.
stringify
(
data
));
});
});
});
player
.
on
(
'play'
,
function
()
{
player
.
on
(
'play'
,
function
()
{
player
.
getCurrentTime
(
function
(
valu
e
)
{
getCurrentTimeAndSlide
(
function
(
currentTime
,
currentSlid
e
)
{
var
data
=
{
var
data
=
{
'event_type'
:
'microsoft.office.mix.played'
,
'event_type'
:
'microsoft.office.mix.played'
,
url
:
mixUrl
,
url
:
mixUrl
,
time
:
value
currentTime
:
currentTime
,
currentSlide
:
currentSlide
};
};
$
.
post
(
eventUrl
,
JSON
.
stringify
(
data
));
$
.
post
(
eventUrl
,
JSON
.
stringify
(
data
));
...
@@ -29,11 +53,12 @@ function OfficeMixBlock(runtime, element) {
...
@@ -29,11 +53,12 @@ function OfficeMixBlock(runtime, element) {
});
});
player
.
on
(
'pause'
,
function
()
{
player
.
on
(
'pause'
,
function
()
{
player
.
getCurrentTime
(
function
(
valu
e
)
{
getCurrentTimeAndSlide
(
function
(
currentTime
,
currentSlid
e
)
{
var
data
=
{
var
data
=
{
'event_type'
:
'microsoft.office.mix.paused'
,
'event_type'
:
'microsoft.office.mix.paused'
,
url
:
mixUrl
,
url
:
mixUrl
,
time
:
value
currentTime
:
currentTime
,
currentSlide
:
currentSlide
};
};
$
.
post
(
eventUrl
,
JSON
.
stringify
(
data
));
$
.
post
(
eventUrl
,
JSON
.
stringify
(
data
));
...
@@ -48,5 +73,15 @@ function OfficeMixBlock(runtime, element) {
...
@@ -48,5 +73,15 @@ function OfficeMixBlock(runtime, element) {
$
.
post
(
eventUrl
,
JSON
.
stringify
(
data
));
$
.
post
(
eventUrl
,
JSON
.
stringify
(
data
));
});
});
player
.
on
(
'pageupdate'
,
function
(
pageUpdateEvent
)
{
var
data
=
{
'event_type'
:
'microsoft.office.mix.slide_changed'
,
url
:
mixUrl
,
slide
:
convertSlideIndex
(
pageUpdateEvent
.
page
)
};
$
.
post
(
eventUrl
,
JSON
.
stringify
(
data
));
});
});
});
}
}
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