Greg Schoppe
Greg Schoppe

Reputation: 574

How can I modify the attributes on the VIDEO tag in Clappr

I am trying to implement IOS 10's new playsinline attribute in Clappr (clappr.io), via a custom plugin. Currently I have the following code:

var IOS_Fullscreen_Plugin = Clappr.UIContainerPlugin.extend({
  name: 'IOS_Fullscreen_Plugin',
  bindEvents: function() {
    this.on(Clappr.Events.PLAYBACK_READY, this.add_attributes);
  },
  add_attributes: function() {
    var $container = this.container.$el;
    var $video = $container.find('video');
    $video.attr('webkit-playsinline','').attr('playsinline','');
    return this;
  }
});

The trick is that I need the code to fire before playback is triggered, but after the video element is populated, but every hook I've used seems to come up on one side or the other of that line. Any ideas? (with this code, it appears to fire before the video element is populated)

Upvotes: 3

Views: 782

Answers (1)

Leandro Moreira
Leandro Moreira

Reputation: 377

You can pass a config named playInline to solve this.

Upvotes: -1

Related Questions