videojs-soundcloud
videojs-soundcloud copied to clipboard
A videojs plugin to support soundcloud links
videojs-soundcloud
A videojs/video-js plugin to support soundcloud track links like:
- https://soundcloud.com/vaughan-1-1/this-is-what-crazy-looks-like
Example
npm install && grunt compile
will compile
- src/media.soundcloud.coffee
- index.jade
One can then open the generated index.html
.
Developing
-
npm install
to prepare the environment -
npm test
to run the tests once (Karma with Jasmine) -
npm run karma
to run tests continuously once a file is changed -
grunt
afternpm install
to prepare running the example at example/index.html -
grunt watch
to continuously compile coffee and jade, and run livereload for the example you can run this alongsidenpm run karma
if you wish
How it works
We create an iframe (with a soundcloud-embed URL) in the player-element and,
using the soundcloud Widget API,
we initialize a widget that will give us the control methods, getters and setters we need.
Once the iframe is created it is hidden!
More in detail notes
Since communication between the parent page and the widget's iframe is implemented through window.postMessage, it's not possible to return the value synchronously. Because of this, every getter method accepts a callback function as a parameter which, when called, will be given the return value of the getter method.
Due to this we have quite a few state variables when using the widget API.
Documentation
Is generated with Codo and hosted on coffeedoc.info. Props to them :)