Skip to content

Instantly share code, notes, and snippets.

@ryanmark
Created September 3, 2014 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanmark/7c50f306e5b1b00ac135 to your computer and use it in GitHub Desktop.
Save ryanmark/7c50f306e5b1b00ac135 to your computer and use it in GitHub Desktop.
<div id="ooyalaplayer<%= division[:id] %>" class="OoyalaHtml5VideoPlayer"></div>
<script>
OO.ready(function() {
var setup = function() {
OO.Player.create(
'ooyalaplayer<%= division[:id] %>', '<%= division[:video] %>', {
onCreate: function(player) {
var thisPlayer = player;
$('#<%= division[:id] %>').on('page.unload', function() {
thisPlayer.pause();
if(thisPlayer.getState() != "paused")
thisPlayer.destroy();
});
}
});
}
$('#<%= division[:id] %>').on('page.load', setup);
<% if current %>setup();<% end %>
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment