4

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

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
grcoder
  • 324
  • 5
  • 17

1 Answers1

2

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' }] };