bikegriffith / clappr-playback-rate-plugin

A plugin for the Clappr HTML5 video player that enables variable speed playback (0.5x, 1x, 2x, ...)
MIT License
37 stars 18 forks source link

PlaybackRatePlugin is not defined #12

Open navjotss opened 6 years ago

navjotss commented 6 years ago

Tried Both way to call the plugin. But getting the same error every time.

plugins: {
             'core' : [PlaybackRatePlugin]
    },
plugins: {
             core : [PlaybackRatePlugin]
    },

Uncaught ReferenceError: PlaybackRatePlugin is not defined at window.onload ((index):32).

After that i take code and compile it on my local machine. Files are generated, but getting the same error.

bikegriffith commented 6 years ago

It looks like the instructions for using this outside of an ES6 module are incomplete. I'm assuming you're not using webpack or any other ES6 bundler, correct?

The workaround would be to do the following:

<script src="https://cdnjs.cloudflare.com/ajax/libs/clappr/0.2.87/clappr.min.js"></script>
<script>window.clappr = Clappr</script>
<script src="lib/lib/clappr-playback-rate-plugin.min.js"></script>
<script>window.PlaybackRatePlugin = window['clappr-playback-rate-plugin'].default</script>
<script>
    // initialize player as before...
</script>
bikegriffith commented 6 years ago

Also see #8

navjotss commented 6 years ago

Its because i didn't add this in code.

Now its working fine. Thanks @bikegriffith for your instant help.