MediaElement.js limiting playback

19 views
Skip to first unread message

Scott Whitney

unread,
Jan 30, 2016, 1:50:07 PM1/30/16
to MediaElement.js
'm trying to limit the number of times someone can play a video.
This is for quiz purposes. A student should recognize an American Sign Language sign with two or fewer playbacks.

Using straight HTML5 with JavaScript it looks like:

 function playVideo() {
 
var nbrPlay = clickdata[(qNbr-1)]
 
 
if (nbrPlay<2){
 clickdata
[i-1]=nbrPlay+1; 
 clickdata
[(qNbr-1)] = nbrPlay+1;
 v
.load();
 document
.getElementById("videoPlayer").style.visibility = "visible";
 
 
}
 
else{
 
//alert("You may only view the video 2 times.")
 limitViews
();//sends an alert so the user knows he has exceeded the limit.
 
}

I can't figure out how to do something similar with the MediaElement.js player. 
I would be happy to either:
  1. Use the built in controller, but limit the number of times user can click "play"
  2. Remove the controller (Yes, I know how) and use my own button.
Any suggestions?

Here's the application for anyone interested in seeing what I am trying to accomplish:
Reply all
Reply to author
Forward
0 new messages