Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Doc Generation 2 #801

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Re-applied changes from #747 on a clean branch
  • Loading branch information
heff committed Oct 29, 2013
commit d8b48a5efd9a44956491d8b4672cbf5013d05b56
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.DS_Store
dist/*
build/files/*
docs/api/*
dev.html
projects
.zenflow-log
Expand Down
29 changes: 21 additions & 8 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ module.exports = function(grunt) {
};
version.majorMinor = version.major + '.' + version.minor;

// loading predefined source order from source-loader.js
// trust me, this is the easist way to do it so far
/*jshint undef:false, evil:true */
var blockSourceLoading = true;
var sourceFiles; // Needed to satisfy jshint
eval(grunt.file.read('./build/source-loader.js'));

// Project configuration.
grunt.initConfig({
pkg: pkg,
Expand Down Expand Up @@ -131,6 +138,15 @@ module.exports = function(grunt) {
configFile: 'test/karma.conf.js',
autoWatch: false
}
},
vjsdocs: {
all: {
src: sourceFiles,
dest: 'docs/api',
options: {
baseURL: 'https://github.com/videojs/video.js/blob/master/'
}
}
}
});

Expand All @@ -144,6 +160,10 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-s3');
grunt.loadNpmTasks('contribflow');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('videojs-doc-generator');

// grunt.loadTasks('./docs/tasks/');
// grunt.loadTasks('../videojs-doc-generator/tasks/');

// Default task.
grunt.registerTask('default', ['jshint', 'less', 'build', 'minify', 'dist']);
Expand All @@ -155,14 +175,6 @@ module.exports = function(grunt) {
gzip = require('zlib').gzip;

grunt.registerMultiTask('build', 'Building Source', function(){
/*jshint undef:false, evil:true */

// Loading predefined source order from source-loader.js
// Trust me, this is the easist way to do it so far.
var blockSourceLoading = true;
var sourceFiles; // Needed to satisfy jshint
eval(grunt.file.read('./build/source-loader.js'));

// Fix windows file path delimiter issue
var i = sourceFiles.length;
while (i--) {
Expand Down Expand Up @@ -307,4 +319,5 @@ module.exports = function(grunt) {
done();
});
});

};
22 changes: 18 additions & 4 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
API
===
The Video.js API allows you to interact with the video through Javascript, whether the browser is playing the video through HTML5 video, Flash, or any other supported playback technologies.

The Video.js API allows you to interact with the video through JavaScript, whether the browser is playing the video through HTML5 video, Flash, or any other supported playback technologies.

Referencing the Player
----------------------
To use the API functions, you need access to the player object. Luckily this is easy to get. You just need to make sure your video tag has an ID. The example embed code has an ID of "example\_video_1". If you have multiple videos on one page, make sure every video tag has a unique ID.

```js
var myPlayer = videojs("example_video_1");
var myPlayer = videojs('example_video_1');
```

(If the player hasn't been initialized yet via the data-setup attribute or another method, this will also initialize the player.)

Wait Until the Player is Ready
------------------------------
The time it takes Video.js to set up the video and API will vary depending on the playback technology being used (HTML5 will often be much faster to load than Flash). For that reason we want to use the player's 'ready' function to trigger any code that requires the player's API.

```javascript
videojs("example_video_1").ready(function(){

var myPlayer = this;

// EXAMPLE: Start playing the video.
Expand All @@ -27,7 +29,19 @@ videojs("example_video_1").ready(function(){

API Methods
-----------
Now that you have access to a ready player, you can control the video, get values, or respond to video events using the following functions. The Video.js API function names follow the [HTML5 media API](http://www.w3.org/TR/html5/video.html). The main difference is that attributes which you would get or set on a video element using the equals sign ( `myVideoElement.currentTime = "120";` ), you would use a function argument syntax for Video.js ( `myPlayer.currentTime(120);` )
Now that you have access to a ready player, you can control the video, get values, or respond to video events. The Video.js API function names follow the [HTML5 media API](http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html). The main difference is that getter/setter functions are used for video properties.

```js

// setting a property on a bare HTML5 video element
myVideoElement.currentTime = "120";

// setting a property on a Video.js player
myPlayer.currentTime(120);

```

The full list can be found

### play() ###
Start video playback. Returns the player object.
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"uglify-js": "~2.3.6",
"grunt-contrib-less": "~0.6.4",
"grunt-karma": "~0.4.4",
"karma-qunit": "~0.0.2"
"karma-qunit": "~0.0.2",
"videojs-doc-generator": "0.0.1"
},
"testling": {
"browsers": [
Expand Down
1 change: 1 addition & 0 deletions src/js/big-play-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* big play button is done via CSS and player states.
* @param {vjs.Player|Object} player
* @param {Object=} options
* @class
* @constructor
*/
vjs.BigPlayButton = vjs.Button.extend();
Expand Down
6 changes: 5 additions & 1 deletion src/js/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
* Base class for all buttons
* @param {vjs.Player|Object} player
* @param {Object=} options
* @class
* @constructor
*/
vjs.Button = vjs.Component.extend({
/** @constructor */
/**
* @constructor
* @inheritDoc
*/
init: function(player, options){
vjs.Component.call(this, player, options);

Expand Down
Loading