grcoder
grcoder

Reputation: 333

Configuring Plyr player source

I'm trying to configue a vimeo player using the "plyr html5 player". But as I try to send the source through js it simply won't work, Just gives me back the error player.source is not a function.

HTML:

<div id="p1_s2_vimeo-id" class="p1_s2-player" data-type="vimeo" data-video-id="">

JS:

var player = plyr.setup('.p1_s2-player', {
  html: controls
});

player.source({
  type:       'video',
  title:      'Example title',
  sources: [{
      src:    '143418951',
      type:   'vimeo'
  }]
}); 

The Fiddle

Upvotes: 5

Views: 3744

Answers (1)

Mikael Colboc
Mikael Colboc

Reputation: 31

This is old but I had the same issue so here is the fix: You are using the wrong syntax to load the source, you need to use:

player.source = { type: 'video', title: 'Example title', sources: [{ src: '143418951', type: 'vimeo' }] };

Upvotes: 3

Related Questions