Embed videos using AngularJS directives
A small project I've started while learning angularJS. It has no real purpose other than educational.
http://erost.net/ng-videosharing-embed/
$ bower install ng-videosharing-embed
Once installed, add videosharing-embed as a dependency in your module:
angular.module('myModule', ['videosharing-embed']);
- AngularJS v1.0.0+ is supported
- Youtube (standard and nocookies, iframe, JS API support)
- Dailymotion (iframe, JS API support)
- Vimeo (iframe, JS API support)
- Youku (iframe, tentative)
Note on JS API:
Each iframe should be identified with a unique id. That ID can be configured by iframe-id
Example
<embed-video iframe-id="vimeo1" api="1" player_id="vimeo1" ng-href="//vimeo.com/111690998"><a href="//vimeo.com/111690998">Watch</a></embed-video>
Generic
<embed-video href="<videoUrl>" width=xxx height=xxx [options]></embed-video>
Example
<embed-video data-ng-href="http://www.youtube.com/watch?v=LOKyEt36Kjc" controls=0><a href="http://www.youtube.com/watch?v=LOKyEt36Kjc">Watch</a></embed-video>
Player's options are unique for each video source. For a list of available options, take a look at src/angular-embedplayer.js, or the player official documentation