Sunday, May 12, 2024
 Popular · Latest · Hot · Upcoming
180
rated 0 times [  181] [ 1]  / answers: 1 / hits: 20582  / 13 Years ago, mon, august 1, 2011, 12:00:00

i am using mediaelementjs for playing video on my website but i need to call some



function at the END/pause of video.So please tell me how an i do this?



Thanks in advance


More From » jquery

 Answers
89

You need to create a new EventListener for the ended and pause events.



Example:



YourMediaElement.addEventListener('ended', function(){
//Your Code goes here
});


Update: This method should be applied on the success handler of creating the element, as is shown in the example on the bottom of the page at MediaElementJS.com



success: function (YourMediaElement, domObject) { 

// add event listener
YourMediaElement.addEventListener('ended', function(e) {

//Do Stuff here

}, false);

[#90889] Friday, July 29, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bradenc

Total Points: 75
Total Questions: 96
Total Answers: 129

Location: Burundi
Member since Thu, Feb 10, 2022
2 Years ago
;