Skip to content

Instantly share code, notes, and snippets.

@jhorsman
Created October 31, 2013 12:26
Show Gist options
  • Save jhorsman/7248844 to your computer and use it in GitHub Desktop.
Save jhorsman/7248844 to your computer and use it in GitHub Desktop.
Media Manager play pause event
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script>
$(document).bind("MMPLAYERREADY", subscribePlayPauseEvent);
function subscribePlayPauseEvent() {
$("#myPlayer").find(".ppplay").first().click(trackVideoPlay);
$("#myPlayer").find(".pppause").first().click(trackVideoPause);
}
function trackVideoPlay(event) {
var playerId = $(event.target).closest(".player").attr("id");
console.log("The video starts playing; player id: " + playerId);
}
function trackVideoPause(event) {
var playerId = $(event.target).closest(".player").attr("id");
console.log("The video pauses; player id: " + playerId);
}
</script>
<style type="text/css">
.player {
background-color: #E0E0E0;
width: 600px;
height: 338px;
}
</style>
</head>
<body>
<div id="myPlayer" class="player">
<script type="text/javascript" language="javascript" src="http://sdl-training.dist.sdlmedia.com/vms/distribution/embed/?o=2981B015-A171-4C6A-BEC6-9C0BC80B9F4E"></script>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment