DigitalSM
DigitalSM

Reputation: 113

Can I add a title attribute in the video element of bitmovin video player?

I use a service called Matomo that tracks media analytics. One of the things I want to track is the video title, but in the bitmovin configuration there is no video title. When I track videos from youtube in my site it works fine because there is a title in the iframe. I tried doing this:

configuration: {
   source: {
      type: 'video/mp4',
      url:  'www.test.gr',
      name: 'my-title',
      title: 'my-title'
   }
}

(I saw that name was always there so I did not remove it). I also added the title with jQuery in the configuration where I can use events

       ready: function (e) {
          $('video#bitmovinplayer-video').attr('title', 'my-title');
       },

This seemed to work but not always, because sometimes there are a lot of videos in the same page and it gets difficult to track the right title, or the matomo service begins tracking when the video appears, before the configuration ends, so the title is not really there yet.

Is there any other way to use the title while the player is been configured and before the autoplay that I have in the playback begins? Thank you.

Upvotes: 1

Views: 688

Answers (1)

Daniel
Daniel

Reputation: 1256

The Bitmovin Player contains an optional title attribute in the SourceConfig. However, it doesn't set the title on the video element. Is this the only way Matomo can track it? Sorry, I'm not familiar that Analytics solution.

You can use getVideoElement instead of the jQuery selector to retrieve the correct video element the player is using and avoid problems with multiple players.

Another option would be to create the video element(s) yourself, add the title and pass the video element to the player using setVideoElement.

Upvotes: 1

Related Questions