Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

videojs object has no method addEvent

I've got videojs installed and working for playback of videos, however when I try to use the API I am hitting some issues

For example:

_V_("video").ready(function() {
   v = this
   v.play()
 }

Works as expected, playing the video once everything has loaded.

However, tracking a click on the play event thus:

_V_("video").ready(function() {
   v = this
   v.addEvent('play', function() { console.log('play') })
 }

Gives me:

Uncaught TypeError: Object [object Object] has no method 'addEvent' 

I'm not sure what I am doing wrong as I am following the API docs.

like image 244
timstermatic Avatar asked Jun 04 '13 18:06

timstermatic


1 Answers

In Video.js 4.0, addEvent was replace by 'on'.

v.on('play', fn);
like image 68
heff Avatar answered Sep 24 '22 14:09

heff