Closed CreateSean closed 1 year ago
I'm unfamiliar with Plyr, but one thing that stands out is that you should be using <script>
tags in your Sprig component, rather than {% js %}
tags, since this is a template partial and not a full page.
Ben,
That helped. I moved it into a script tag and changed
constplayer{{ entry.id }} = new Plyr('#player{{ entry.id }}');
to
var player{{ entry.id }} = new Plyr('#player{{ entry.id }}');
with const
I was getting Uncaught SyntaxError: Identifier 'player4274' has already been declared
but once I changed to var all good.
Great! If you're not referencing the player later, I assume it is safe to drop the variable completely.
<script>
new Plyr('#player{{ entry.id }}');
</script>
Craft 4.2.5.2 Sprig 2.2.1
I've got sprig pagination working fine. It loads the next page successfully however the videos which are run using the plyr.io script. use the YouTube player on sprig paginated pages. See screen recording: Screen Recording - dropbox
main template
video listing template
I'm stuck and not sure how to troubleshoot this. Please advise