Skip to content

Commit

Permalink
Improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
David Karchmer committed Sep 12, 2015
1 parent 823d8c5 commit 78c9a25
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,57 @@ bower install ng-jwplayer --save

### Usage

* Use the jwplayer.js that you downloaded from jwplayer.com, and then include in your html:

~~~~
<script type="text/javascript" src="bower_components/angular/angular.js"></script>
<!-- Remplace xxxxxxxxx with your license code given by JWPLayer -->
<script src="https://content.jwplatform.com/libraries/xxxxxxxxxxxx.js"></script>
<script type="text/javascript" src="bower_components/ng-jwplayer/jwplayer.js"></script>
~~~~

* Create all JWPLayer setup options as a object (see http://support.jwplayer.com/customer/portal/articles/1413113-configuration-options-reference). Add th video file as an ng-src

~~~~
$scope.options = {
height: 360,
width: 640,
advertising: {
client: "vast",
tag: "http://adserver.com/vastTag.xml"
}
}
$scope.file: "http://example.com/myVideo.mp4",
~~~~

* A sample script will look like this

~~~~
var myApp = angular.module('myApp', ['ng-jwplayer']);
myApp.controller('mainController', ['$scope', '$log', '$sce', function($scope, $log, $sce) {
$scope.name = 'JWPlayer Example';
$scope.options = {
type: 'mp4'
};
$scope.file = $sce.trustAsResourceUrl('http://vjs.zencdn.net/v/oceans.mp4');
]);
~~~~

* On your HTML, use the jwplayer directive:

~~~~
<jwplayer ng-src="{{ file }}"
player-options="options"
player-id="myPlayer1">
</jwplayer>
~~~~

### Contribute

Expand Down

0 comments on commit 78c9a25

Please sign in to comment.