Comparar commits

..

83 Commits

Autor SHA1 Mensagem Data
Steve Heffernan 90956059f6 Updated to newest version of Flash player. Preparing for final release. 2012-01-09 12:18:08 -08:00
Steve Heffernan ab07612c05 Updated playback tech docs 2012-01-09 10:05:19 -08:00
Steve Heffernan 7ef5b15ae2 Updated api and setup docs 2012-01-05 23:25:09 -08:00
Steve Heffernan 9678c7717f Added manual poster image to get around flash cross domain issues.
Starting controls hidden.
Making tech elements clickable.
2012-01-02 16:57:17 -08:00
Steve Heffernan 8dd38fc747 Updated flash player 2012-01-02 15:37:37 -08:00
Steve Heffernan 242ff4c68b Fixed tech switching.
Fixed an issue where bigplaybutton was throwing an error when not preloading.
Fixed a bufferring issue when tech switching.
2012-01-02 13:02:04 -08:00
Steve Heffernan 38cc63c530 Merge branch 'master' of github.com:zencoder/video-js 2012-01-02 10:16:42 -08:00
Steve Heffernan 41b93513a2 Updated docs for site. Add 'projects' to gitignore. 2012-01-02 10:14:51 -08:00
Heff 359cde31c2 Merge pull request #111 from mchristopher/master
Maintain license block
2011-12-27 14:52:28 -08:00
Michael Christopher 1fba4f4b88 Added ! to first line of license block so YCompress doesn't strip it out 2011-12-27 16:50:32 -06:00
Steve Heffernan 16f6c229f3 Merge branch 'master' of github.com:zencoder/video-js 2011-12-21 18:16:12 -08:00
Steve Heffernan accdfcb02c Cleaned up spinner code. 2011-12-21 18:15:47 -08:00
Heff ee1a7dae99 Merge pull request #106 from tremby/master
Fix #105
2011-12-21 18:13:03 -08:00
Heff b31eba988b Merge pull request #103 from rkyrychuk/patch-3
Auto rewind on big button play click
2011-12-21 18:10:19 -08:00
Heff 20b36faf11 Merge pull request #102 from rkyrychuk/patch-2
Ensure that tracking progress and time progress will stop after destroy
2011-12-21 18:07:50 -08:00
Steve Heffernan 82142e2f54 Added loading spinner code from ZenJosh. 2011-12-21 17:59:36 -08:00
Bart Nagel 1c18578466 automatically create dist subdirectory 2011-12-16 01:06:00 -08:00
Bart Nagel 0e81c6b059 fixed cue search algorithm bug 2011-12-16 00:52:15 -08:00
rkyrychuk 99fa329bc5 Auto rewind on big button play click 2011-12-15 23:58:35 +02:00
rkyrychuk f13a2bf733 Ensure that tracking progress and time progress will stop and player deleted after calling destroy method 2011-12-15 23:17:10 +02:00
Steve Heffernan 6945be3d6e Updated volume display to automically set itself. 2011-12-08 17:33:44 -08:00
Steve Heffernan d1fb95ecbf Fixed another issue with passing vars to flash 2011-12-07 22:12:36 -08:00
Steve Heffernan 176eb1f559 Fixed an error with updating tech support. 2011-12-07 22:04:54 -08:00
Steve Heffernan 8babbb412c Cleaned up tech name 2011-12-07 22:02:40 -08:00
Steve Heffernan f4e68d1a47 Fix flashvar name 2011-12-07 21:41:28 -08:00
Steve Heffernan e0516a4c83 Added ability to pass options to flash fallback. 2011-12-07 21:29:21 -08:00
Steve Heffernan 1972528df7 Changed h5swf name to just Flash for ease of use. And lowercased tech object names. 2011-12-07 21:03:12 -08:00
Steve Heffernan 39f7bead50 Updated compare page. 2011-12-07 16:44:21 -08:00
Steve Heffernan e4f6bbb0b2 Optimized slider controls.
Fixed issue with fullscreen progress bar tracking (offset left wasn't working in new fullscreen)
2011-12-05 11:28:18 -08:00
Steve Heffernan afc9369849 Merge branch 'master' of github.com:zencoder/video-js
Conflicts:
	src/player.js
	src/tech.js
2011-12-01 16:52:23 -08:00
Steve Heffernan 325084c6a1 Updated swf code to auto play on new src. 2011-12-01 16:48:06 -08:00
Heff 2f99215f8d Merge pull request #98 from ZenJosh/master
Refactored fullscreen logic
2011-12-01 16:47:55 -08:00
Josh Pickett d90cee588a Removed try catch from requestFullScreen 2011-12-01 16:35:13 -08:00
Josh Pickett 00a38f76a7 Refactored fullscreen logic 2011-12-01 16:29:52 -08:00
Steve Heffernan b329dfd107 Merge branch 'master' of github.com:zencoder/video-js 2011-12-01 16:17:40 -08:00
Heff 11286190fa Merge pull request #97 from ZenJosh/master
Fixed Firefox/IE9 fullWindow bug
2011-12-01 16:17:28 -08:00
Josh Pickett 05d7a81885 Fixed Firefox/IE9 fullWindow bug 2011-12-01 16:07:19 -08:00
Josh Pickett 1dd70d1c77 Merge branch 'master' of http://github.com/zencoder/video-js 2011-12-01 15:47:53 -08:00
Steve Heffernan 437566740f Merge branch 'master' of github.com:zencoder/video-js 2011-12-01 15:47:52 -08:00
Steve Heffernan 7e747e95ab Updated swf object to newest version.
Optimizing player for later loaded sources.
2011-12-01 15:47:12 -08:00
Heff de6230644e Merge pull request #96 from ZenJosh/master
Added fullscreen controls to supported browsers
2011-12-01 15:46:32 -08:00
Josh Pickett 08aa73ccf6 Added fullscreen with controls to supported browsers 2011-12-01 15:38:15 -08:00
Josh Pickett 2607e82aaf Native fullscreen with controls added for supported browsers 2011-12-01 15:24:34 -08:00
Steve Heffernan ec145f6d4d Fixed an issue with ajax errors 2011-11-30 14:05:28 -08:00
Steve Heffernan 78a3b16e9c Cleaned up dev.html.example 2011-11-30 13:34:33 -08:00
Steve Heffernan 58cf933091 Updated readme to talk about dev.html 2011-11-30 13:27:21 -08:00
Steve Heffernan f8fc9a8d7b Renamed to dev.html.example 2011-11-30 13:14:39 -08:00
Steve Heffernan 5f4369e188 Added dev.html to gitignore 2011-11-30 13:13:35 -08:00
Steve Heffernan 4593421adb Removing dev.html and adding dev_example.html to allow for testing without pushing changes to dev.html 2011-11-30 13:12:28 -08:00
Steve Heffernan f0154eeab7 Added support for loading the player first and then setting the source later.
Fixed iOS loading issue.
2011-11-30 13:06:32 -08:00
Steve Heffernan 1e284827d7 Modified some comments 2011-11-30 11:53:08 -08:00
Steve Heffernan 3e99e630ea Added gitignore 2011-11-29 19:36:50 -08:00
Steve Heffernan 0c7334c861 Fixed some IE comma errors. Made ajax error clearer. Fixed a setup issue. 2011-11-29 16:39:43 -08:00
Steve Heffernan 82d55c45e7 Updated error with updating tech support 2011-11-29 12:12:13 -08:00
Steve Heffernan 7538241008 MAJOR REFACTOR: Restrcutured code into class-based components. Setup and configuring should still work the same, but controls and tech elements are now sub-classes for Component, which builds elements and applies event behaviors.
Removed demo source code from repository root. Was receiving pull requests for the release files instead of source files. This makes it more clear where to make changes.

Merge branch 'master' of github.com:zencoder/video-js

Conflicts:
	dev/src/api.js
2011-11-29 11:42:28 -08:00
Steve Heffernan 6193e01004 MAJOR REFACTOR: Restrcutured code into class-based components. Setup and configuring should still work the same, but controls and tech elements are now sub-classes for Component, which builds elements and applies event behaviors.
Removed demo source code from repository root. Was receiving pull requests for the release files instead of source files. This makes it more clear where to make changes.

Merge branch 'ui'

Conflicts:
	dev/flash/VideoJS.swf
2011-11-29 11:41:42 -08:00
Steve Heffernan ef321a8072 MAJOR REFACTOR: Restrcutured code into class-based components. Setup and configuring should still work the same, but controls and tech elements are now sub-classes for Component, which builds elements and applies event behaviors.
Removed demo source code from repository root. Was receiving pull requests for the release files instead of source files. This makes it more clear where to make changes.
2011-11-29 11:40:05 -08:00
Heff e5a44eef58 Merge pull request #92 from stevecochrane/master
Fixed a bug in api.js that would cause a JavaScript error when entering fullscreen, in HTML5 mode, for browsers that support fullscreen (Safari)
2011-11-29 10:48:42 -08:00
Steve Heffernan 5488570745 Update flash player 2011-11-21 19:44:39 -08:00
Steve Heffernan a314c0a242 Attempting new UI organization. 2011-11-21 17:19:31 -08:00
Steve Cochrane 53e1d0eb65 Fixed a bug with an enterFullScreen API call which was using a non-existant 'api()' method, when it should have been 'apiCall()'. This caused a JavaScript error which would break fullscreen in HTML5 mode for browsers that support it (Safari). 2011-11-21 14:35:58 -08:00
Steve Heffernan 193172498c Added fix for h5swf Flash version checking. (Issue 90)
Added fix for iPhone move in dom var. (Issue 84)
2011-11-18 15:53:00 -08:00
Steve Heffernan 7da9bdd073 Added licence info back to top of script. 2011-11-18 14:37:55 -08:00
Steve Heffernan df3718cd55 Updated to new version of SWF 2011-11-17 16:54:02 -08:00
Steve Heffernan c5a22081b4 Removed dist version. Minor changes/optimizations. 2011-11-17 16:28:49 -08:00
Steve Heffernan 3fc71d098d Added ready callback to setup.
Moved _V_.players storing to init.
2011-11-15 18:04:39 -08:00
Steve Heffernan 34c187cd9a Updated init script to allow for controls attribute to be false. 2011-11-15 13:27:37 -08:00
Steve Heffernan 3243b01e6c Added autoplay fix for Safari.
Added CSS updated to src files.
2011-11-14 17:32:10 -08:00
Steve Heffernan cc27d630c6 Merge branch 'master' of github.com:zencoder/video-js 2011-11-14 16:54:22 -08:00
Heff db0033ebe5 Merge pull request #81 from kristerkari/master
Simplify CSS gradient syntax & Drop units from zero values
2011-11-14 11:53:48 -08:00
Krister Kari c2b43903ab Simplify CSS gradient syntax 2011-10-14 23:03:33 +03:00
Krister Kari 2ea9c99f34 Drop units from zero values 2011-10-14 22:16:04 +03:00
Steve Heffernan 449c7014fb Merge branch 'master' of github.com:zencoder/video-js 2011-10-03 16:01:38 -07:00
Heff 6d59836b76 Merge pull request #79 from argami/master
Totally forgot to add the modification to src
2011-10-03 15:35:58 -07:00
Gamaliel A. Toro Herrera e703e1591e - combine_sources.sh last line didn't execute some character in the previous one removed
- re-generated video.js on the main
2011-10-03 22:56:12 +02:00
Gamaliel A. Toro Herrera c4f87649e4 - added technology order (source and dist) if everything fails last option flash 2011-10-03 21:20:09 +02:00
Steve Heffernan 6cccf594ad Added tagging notes 2011-10-03 11:12:21 -07:00
Steve Heffernan df41661f47 Moved youtube test file. 2011-10-03 10:32:07 -07:00
Steve Heffernan 3daa81f87e Merge branch 'master' of github.com:zencoder/video-js 2011-10-03 10:30:48 -07:00
Steve Heffernan 4f60eb896c Added YouTube support at video hack day SF. 2011-10-03 10:25:02 -07:00
Heff ee7318f6ae Merge pull request #78 from argami/master
New version is using flash all the time (sorry, was testing and forgot to switch back)
2011-10-03 10:24:08 -07:00
Gamaliel A. Toro Herrera d7aa9f9558 - change order of technologies to check first html5 over flash 2011-10-03 17:38:13 +02:00
Steve Heffernan 442696cfc2 Version 3.0 BETA 2011-09-30 17:28:43 -07:00
104 arquivos alterados com 10054 adições e 5208 exclusões
+4
Ver Arquivo
@@ -0,0 +1,4 @@
.DS_Store
dist/*
dev.html
projects
Ver Arquivo
-215
Ver Arquivo
@@ -1,215 +0,0 @@
VideoJS - [HTML5 Video Player](http://videojs.com)
==================================================
Version 2.0.2
View [VideoJS.com](http://videojs.com) for a demo and overview.
VideoJS is an HTML5 video player that uses the HTML5 video tag built into modern browsers, and uses javascript to add custom controls, new functionality, and to fix cross browser bugs.
The base of VideoJS is Kroc Camen's [Video for Everybody](http://camendesign.com/code/video_for_everybody), which is a video embed code that falls back to a Flash video player or download links for browsers and devices that don't support HTML5 video.
View demo.html for an example of how to use it.
Originally based on [this tutorial](http://blog.steveheffernan.com/2010/04/how-to-build-an-html5-video-player/).
Contributors (Github Username)
------------------------------
heff, dz0ny, sentientbit, tvdeyen, brandonarbini, gordonbrander, Shraymonks, albertogasparin, sandaru1, nicholasbs, majornista, Fredust85, @wonderboymusic, ellis-, emirpprime, eirikb, mbrubeck
Getting Started
---------------
### Step 1: Include VideoJS Javascript and CSS files in your page.
Change the src/href to the appropriate location on your server.
<script src="video.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="video-js.css" type="text/css" media="screen" title="Video JS" charset="utf-8">
### Step 2: Add the VideoJS setup code to your page or another script.
Must run after the VideoJS javascript file has been included
<script type="text/javascript" charset="utf-8">
// Add VideoJS to all video tags on the page when the DOM is ready
VideoJS.setupAllWhenReady();
</script>
### Step 3: Add the VideoJS embed code to your page (grab the latest version for demo.html).
Change the video and image files to your own. You can even swap out the Flash Fallback for your own, just maintain the "vjs-flash-fallback" class on the object. I know, seems like a lot of HTML, but it's super compatible. [Check it](http://camendesign.com/code/video_for_everybody/test.html).
<!-- Begin VideoJS -->
<div class="video-js-box">
<!-- Using the Video for Everybody Embed Code http://camendesign.com/code/video_for_everybody -->
<video id="example_video_1" class="video-js" width="640" height="264" poster="http://video-js.zencoder.com/oceans-clip.png" controls preload>
<source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
<source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm; codecs="vp8, vorbis"' />
<source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg; codecs="theora, vorbis"' />
<!-- Flash Fallback. Use any flash video player here. Make sure to keep the vjs-flash-fallback class. -->
<object id="flash_fallback_1" class="vjs-flash-fallback" width="640" height="264" type="application/x-shockwave-flash"
data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf">
<param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" />
<param name="wmode" value="opaque" />
<param name="allowfullscreen" value="true" />
<param name="flashvars" value='config={"playlist":["http://video-js.zencoder.com/oceans-clip.png", {"url": "http://video-js.zencoder.com/oceans-clip.mp4","autoPlay":false,"autoBuffering":true}]}' />
<!-- Image Fallback. Typically the same as the poster image. -->
<img src="http://video-js.zencoder.com/oceans-clip.png" width="640" height="264" alt="Poster Image"
title="No video playback capabilities." />
</object>
</video>
<!-- Download links provided for devices that can't play video in the browser. -->
<p class="vjs-no-video"><strong>Download Video:</strong>
<a href="http://video-js.zencoder.com/oceans-clip.mp4">MP4</a>,
<a href="http://video-js.zencoder.com/oceans-clip.webm">WebM</a>,
<a href="http://video-js.zencoder.com/oceans-clip.ogv">Ogg</a><br>
<!-- Support VideoJS by keeping this link. -->
<a href="http://videojs.com">HTML5 Video Player</a> by VideoJS
</p>
</div>
<!-- End VideoJS -->
Storing a Reference to the Player(s)
------------------------------------
You can set up the player(s) in a way that allows you to access it later, and control things like the video playback. In this case, the setup has to happen after the DOM has been loaded. You can use any library's DOM Ready method, or the one built into VideoJS.
### Using a Video's ID or Element
VideoJS.DOMReady(function(){
var myPlayer = VideoJS.setup("example_video_1");
});
### Using an array of video elements/IDs
Note: It returns an array of players
VideoJS.DOMReady(function(){
var myManyPlayers = VideoJS.setup(["example_video_1", "example_video_2", video3Element]);
});
### All videos on the page with the "video-js" class
VideoJS.DOMReady(function(){
var myManyPlayers = VideoJS.setup("All");
});
### After you have references to your players you can...(example)
VideoJS.DOMReady(function(){
var myPlayer = VideoJS.setup("example_video_1");
myPlayer.play(); // Starts playing the video for this player.
});
Setting Options
---------------
Set options when setting up the videos. The defaults are shown here.
VideoJS.setupAllWhenReady({
controlsBelow: false, // Display control bar below video instead of in front of
controlsHiding: true, // Hide controls when mouse is not over the video
defaultVolume: 0.85, // Will be overridden by user's last volume if available
flashPlayerVersion: 9, // Required flash version for fallback
});
### Or as the second option of VideoJS.setup
VideoJS.DOMReady(function(){
var myPlayer = VideoJS.setup("example_video_1", {
// Same options
});
});
Coming Next
-----------
- API to Flash fallback
Changelog
---------
2.0.3
- Feature: Made returning to the start at the end of the movie an option ("returnToStart").
- Feature: Added loop option to loop movie ("loop").
- Feature: Reorganized player API and listeners.
- Feature: Added option to disable controls. controlsEnabled: false
- Feature: Setup method now has a callback, so you can more easily work with the player after setup
- Feature: Added listeners for enter/exit full screen/window.
- Feature: Added a VideoJS.player(id) function for getting the player for a video ID
- Changes: setupAllWhenReady is now just setupAll (backward compatible)
- Fix: Check for Android browser now excludes firefox and opera
2.0.2 (2010-12-10)
- Feature: Rewrote and optimized subtitle code.
- Feature: Protecting against volume ranges outside of 1 and 0.
- Fix: Bug in Safari for Mac OS 10.5 (Leopard) that was breaking fullscreen.
2.0.1 (2010-11-22)
- Fix: Issue with big play button when multiple videos are on the page.
- Fix: Optimized play progress tracking.
- Fix: Optimized buffer progress checking.
- Fix: Firefox not showing Flash fallback object.
2.0.0 (2010-11-21)
- Feature: Created "behaviors" concept for adding behaviors to elements
- Feature: Switched back to divs for controls, for more portable styles
- Feature: Created playerFallbackOrder array option. ["html5", "flash", "links"]
- Feature: Created playerType concept, for initializing different platforms
- Feature: Added play button for Android
- Feature: Added spinner for iPad (non-fullscreen)
- Feature: Split into multiple files for easier development
- Feature: Combined VideoJS & _V_ into the same variable to reduce confusion
- Fix: Checking for m3u8 files (Apple HTTP Streaming)
- Fix: Catching error on localStorage full that safari seems to randomly throw
- Fix: Scrubbing to end doesn't trigger onEnded
1.1.5 (2010-11-09)
- Feature: Switched to track method for setting subtitles. Now works like spec.
- Feature: Created "players" concept for defining fallbacks and fallback order
- Fix: Android playback bug.
- Fix: Massive reorganization of code to make easier to navigate
1.1.4 (2010-11-06)
- Feature: Added loading spinner.
- Feature: Improved styles loaded checking.
- Feature: Added volume() function to get and set volume through the player.
- Fix: Fix issue where FF would loop video in background when ended.
- Fix: Bug in Chrome that shows poster & plays audio if you set currentTime too quickly.
- Fix: Bug in Safari where waiting is triggered and shows spinner when not needed
- Fix: Updated to show links if only unplayable sources and no Flash.
- Fix: Issue where if play button was loaded after play, it wouldn't hide.
1.1.3 (2010-10-19)
- Feature: Width/Height functions for resizing the player
- Feature: Made initial click & hold trigger new value on progress and volume
- Feature: Made controls not hide when hovering over them
- Feature: Added big play button as default starting control.
- Fix: Removed trailing comma that was breaking IE7
- Fix: Removed some vars from global scope
- Fix: Changed a document.onmousemove to an eventListener to prevent conflicts
- Fix: Added a unique ID to FlowPlayer demo object to fix a FlowPlayer bug. Thanks @emirpprime.
- Fix: Safari error on unloaded video
1.1.2 (2010-09-20)
- Added a fix for the poster bug in iPad/iPhone
- Added more specificity to styles
1.1.1 (2010-09-14)
- First Formally Versioned Release
1.0.0 (2010-05-18)
- First released
+30
Ver Arquivo
@@ -0,0 +1,30 @@
VideoJS - [HTML5 Video Player](http://videojs.com)
==================================================
Version 3.0 BETA
Visit the main site at [videojs.com](http://videojs.com) for download options and instructions.
To build video-js from the latest version of the source, clone the source repository and run:
sh build.sh
in the video-js directory using the commnand-line/terminal of a unix-based system.
Contributing
------------
If you'd like to help out on VideoJS, you are awesome. Updates should be made to the source files and then make a pull request.
When working on VideoJS code, you can use dev.html as your test page. It doesn't exist in the repo and changes to it won't be tracked. To get your own copy simply clone the repo and copy dev.html.example.
cp dev.html.example dev.html
You can use dev.html to test new code. It's simple HTML doc that includes all the source files. Send a pull request for any updates.
---
BETA NOTES
Version 3 is almost a complete rewrite of the previous versions of VideoJS. New features includes:
- HTML/CSS Controls and API now work for both the HTML5 and Flash versions.
- Custom Super-lightweight Flash Fallback
- Embed Code is much simpler.
- No more "vjs-box" div required, just use the video tag.
- No more embedding of Flash fallback within the video tag HTML.
---
Arquivo executável
+48
Ver Arquivo
@@ -0,0 +1,48 @@
#! /bin/csh
# Combines Source Files. In terminal, sh build.sh
# It will put a new video.js file under dist/
# Create dist directory if it doesn't already exist
mkdir -p dist
# FILES=../src/*
# for f in $FILES
# do
# echo "Processing $f file..."
# # take action on each file. $f store current file name
# cat $f
# done
cat src/_begin.js > dist/video.js
cat src/core.js >> dist/video.js
cat src/lib.js >> dist/video.js
cat src/ecma.js >> dist/video.js
cat src/json.js >> dist/video.js
cat src/events.js >> dist/video.js
cat src/component.js >> dist/video.js
cat src/player.js >> dist/video.js
cat src/tech.js >> dist/video.js
cat src/controls.js >> dist/video.js
cat src/tracks.js >> dist/video.js
# h5swf temporarily requires swfobject
cat flash/swfobject.js >> dist/video.js
cat src/setup.js >> dist/video.js
cat src/_end.js >> dist/video.js
# Copy Files
cp design/video-js.css dist/video-js.css
cp design/video-js.png dist/video-js.png
cp flash/video-js.swf dist/video-js.swf
cp build/release-files/README.md dist/README.md
cp build/release-files/demo.html dist/demo.html
cp LGPLv3-LICENSE.txt dist/LGPLv3-LICENSE.txt
java -jar build/lib/yuicompressor-2.4.7.jar dist/video.js -o dist/video.min.js
java -jar build/lib/yuicompressor-2.4.7.jar dist/video-js.css -o dist/video-js.min.css
+24
Ver Arquivo
@@ -0,0 +1,24 @@
Version Numbers
---------------
http://en.wikipedia.org/wiki/Software_versioning#Sequence-based_identifiers
### Major Version (Integer, e.g 3.0)
- Any features where we expect it could break plugins, skins, or any major API integration.
### Minor Version (3.1)
- Additional non-breaking features
### Revision Versions
- Beta (3.1-b1)
- Release Candidate (3.1-rc1)
- Release with revisions (3.1-r1)
Notes:
The last level of one revision type (beta/release candidate) should match the first level of the next revision type. 4.0-b10 should match 4.0-rc1, assuming b10 is the last beta version.
Release revisions means bug fixes. The CDN url should not reflect the revision number. 4.0-r2 would still be /4.0/.
Tagging a Release
-----------------
git tag -a v[version number] [commit]
Arquivo binário não exibido.
+153
Ver Arquivo
@@ -0,0 +1,153 @@
Video.js - [HTML5 Video Player](http://videojs.com)
==================================================
Version 3.0 BETA
---
Version 3 is almost a complete rewrite of the previous versions of Video.js. New features includes:
- HTML/CSS Controls and API now work for both the HTML5 and Flash versions.
- Custom Super-lightweight Flash Fallback
- Embed Code is much simpler.
- No more "vjs-box" div required, just use the video tag.
- No more embedding of Flash fallback within the video tag HTML.
---
View [videojs.com](http://videojs.com) for a demo and overview.
Video.js is an HTML5 video player that uses the HTML5 video tag built into modern browsers, and uses javascript to add custom controls, new functionality, and to fix cross browser bugs. For browsers that don't support HTML5, it will fallback to a Flash player.
View demo.html for an example of how to use it.
Originally based on [this tutorial](http://blog.steveheffernan.com/2010/04/how-to-build-an-html5-video-player/).
Contributors (Github Username)
------------------------------
heff, dz0ny, sentientbit, tvdeyen, brandonarbini, gordonbrander, Shraymonks, albertogasparin, sandaru1, nicholasbs, majornista, Fredust85, @wonderboymusic, ellis-, emirpprime, eirikb, mbrubeck
Getting Started
---------------
### Step 1: Include the Video.js Javascript and CSS files in the head of your page.
Change the file urls to point to the files on your server.
<script src="video.js"></script>
<link href="video-js.css" rel="stylesheet">
### Step 2: Add an HTML5 video tag to your page.
Use the video tag as normal, with a few extra pieces for Video.js:
1. The 'data-setup' attribute tells Video.js to automatically set up the video when the page is ready, and read any options (in JSON format) from the attribute.
2. The 'id' Attribute: Should be used and unique for every video on the same page.
3. The 'class' attribute contains two classes:
- 'video-js' applies styles that are required for Video.js functionality, like fullscreen and subtitles.
- 'vjs-default-skin' applies the default skin to the HTML controls, and can be removed or overridden to create your own controls design.
Otherwise include/exclude attributes, settings, sources, and tracks exactly as you would for HTML5 video.
<video id="example_video_1" class="video-js vjs-default-skin" controls preload="auto" width="640" height="264"
poster="http://video-js.zencoder.com/oceans-clip.png"
data-setup='{"example_option":true}'>
<source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4' />
<source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm' />
</video>
### Step 3: Nada!
That's all it take to get started. See the [docs](http://videojs.com/docs/) for more advanced uses.
Changelog
---------
3.0
- Complete rewrite
- HTML/CSS Controls and API now work for both the HTML5 and Flash versions
- Custom Super-lightweight Flash Fallback
- Embed Code is much simpler.
- No more "vjs-box" div required, just use the video tag.
- No more embedding of Flash fallback within the video tag HTML.
2.0.3
- Feature: Made returning to the start at the end of the movie an option ("returnToStart").
- Feature: Added loop option to loop movie ("loop").
- Feature: Reorganized player API and listeners.
- Feature: Added option to disable controls. controlsEnabled: false
- Feature: Setup method now has a callback, so you can more easily work with the player after setup
- Feature: Added listeners for enter/exit full screen/window.
- Feature: Added a VideoJS.player(id) function for getting the player for a video ID
- Changes: setupAllWhenReady is now just setupAll (backward compatible)
- Fix: Check for Android browser now excludes firefox and opera
2.0.2 (2010-12-10)
- Feature: Rewrote and optimized subtitle code.
- Feature: Protecting against volume ranges outside of 1 and 0.
- Fix: Bug in Safari for Mac OS 10.5 (Leopard) that was breaking fullscreen.
2.0.1 (2010-11-22)
- Fix: Issue with big play button when multiple videos are on the page.
- Fix: Optimized play progress tracking.
- Fix: Optimized buffer progress checking.
- Fix: Firefox not showing Flash fallback object.
2.0.0 (2010-11-21)
- Feature: Created "behaviors" concept for adding behaviors to elements
- Feature: Switched back to divs for controls, for more portable styles
- Feature: Created playerFallbackOrder array option. ["html5", "flash", "links"]
- Feature: Created playerType concept, for initializing different platforms
- Feature: Added play button for Android
- Feature: Added spinner for iPad (non-fullscreen)
- Feature: Split into multiple files for easier development
- Feature: Combined VideoJS & _V_ into the same variable to reduce confusion
- Fix: Checking for m3u8 files (Apple HTTP Streaming)
- Fix: Catching error on localStorage full that safari seems to randomly throw
- Fix: Scrubbing to end doesn't trigger onEnded
1.1.5 (2010-11-09)
- Feature: Switched to track method for setting subtitles. Now works like spec.
- Feature: Created "players" concept for defining fallbacks and fallback order
- Fix: Android playback bug.
- Fix: Massive reorganization of code to make easier to navigate
1.1.4 (2010-11-06)
- Feature: Added loading spinner.
- Feature: Improved styles loaded checking.
- Feature: Added volume() function to get and set volume through the player.
- Fix: Fix issue where FF would loop video in background when ended.
- Fix: Bug in Chrome that shows poster & plays audio if you set currentTime too quickly.
- Fix: Bug in Safari where waiting is triggered and shows spinner when not needed
- Fix: Updated to show links if only unplayable sources and no Flash.
- Fix: Issue where if play button was loaded after play, it wouldn't hide.
1.1.3 (2010-10-19)
- Feature: Width/Height functions for resizing the player
- Feature: Made initial click & hold trigger new value on progress and volume
- Feature: Made controls not hide when hovering over them
- Feature: Added big play button as default starting control.
- Fix: Removed trailing comma that was breaking IE7
- Fix: Removed some vars from global scope
- Fix: Changed a document.onmousemove to an eventListener to prevent conflicts
- Fix: Added a unique ID to FlowPlayer demo object to fix a FlowPlayer bug. Thanks @emirpprime.
- Fix: Safari error on unloaded video
1.1.2 (2010-09-20)
- Added a fix for the poster bug in iPad/iPhone
- Added more specificity to styles
1.1.1 (2010-09-14)
- First Formally Versioned Release
1.0.0 (2010-05-18)
- First released
+23
Ver Arquivo
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<title>VideoJS | HTML5 Video Player</title>
<link href="video-js.css" rel="stylesheet" type="text/css">
<!-- video.js must be in the <head> for older IEs to work. -->
<script src="video.js"></script>
</head>
<body>
<video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="640" height="264"
poster="http://video-js.zencoder.com/oceans-clip.png"
data-setup="{}">
<source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4' />
<source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm' />
<source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg' />
</video>
</body>
</html>
+7
Ver Arquivo
@@ -0,0 +1,7 @@
body { background-color: #ccc; font-size: 11px; font-family: 'Helvetica Neue', helvetica, arial; }
#main { width: 1000px; margin: 10px auto 0; }
td, th { text-align: left; vertical-align: top; }
td.info-col { width: 240px; }
td.data { text-align: right; }
span.na { color: red; }
span.undefined { color: #999; }
+75
Ver Arquivo
@@ -0,0 +1,75 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>HTML5 Video Player</title>
<link rel="stylesheet" href="../design/video-js.css" type="text/css">
<!--[if lt IE 9]>
<script>
document.createElement("video"); // HTML5 Shiv. Must be in <head>.
</script>
<![endif]-->
<!--[if IE]>
<script src="https://getfirebug.com/firebug-lite.js" type="text/javascript" charset="utf-8"></script>
<![endif]-->
<script src="../src/core.js"></script>
<script src="../src/lib.js"></script>
<script src="../src/ecma.js"></script>
<script src="../src/json.js"></script>
<script src="../src/component.js"></script>
<script src="../src/player.js"></script>
<script src="../src/tech.js"></script>
<script src="../src/controls.js"></script>
<script src="../src/events.js"></script>
<script src="../src/tracks.js"></script>
<script src="../flash/swfobject.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<link rel="stylesheet" href="compare.css" type="text/css">
<script type="text/javascript" src="compare.js"></script>
</head>
<body>
<div id="main">
<table border="0" cellspacing="5" cellpadding="5">
<tr><th colspan="2">HTML5</th><th colspan="2">Flash</th></tr>
<tr>
<td colspan="2">
<video id="vid1" class="video-js vjs-default-skin" controls preload="auto" width="480" height="198"
poster="http://video-js.zencoder.com/oceans-clip.png">
<source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4'>
<source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm'>
</video>
</td>
<td colspan="2">
<video id="vid2" class="video-js vjs-default-skin" controls preload="auto" width="480" height="198"
poster="http://video-js.zencoder.com/oceans-clip.png">
<source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4'>
<!-- <source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm'> -->
</video>
</td>
</tr>
<tr>
<td class="info-col">
<table id="html5_props" border="0" cellspacing="0" cellpadding="0"></table>
</td>
<td class="info-col">
<div id="html5_events"></div>
</td>
<td class="info-col">
<table id="flash_props" border="0" cellspacing="0" cellpadding="0"></table>
</td>
<td class="info-col">
<div id="flash_events"></div>
</td>
</tr>
</table>
</div>
</body>
</html>
+70
Ver Arquivo
@@ -0,0 +1,70 @@
_V_.options.flash.swf = "../flash/video-js.swf";
_V_.options.flash.swf = "http://andylemay.com/dev/videojs/VideoJS.swf";
$(function(){
var tech, i, tname, player,
techList = ["html5","flash"],
props = "error,currentSrc,networkState,buffered,readyState,seeking,initialTime,duration,startOffsetTime,paused,played,seekable,ended,videoWidth,videoHeight,textTracks,preload,currentTime,defaultPlaybackRate,playbackRate,autoplay,loop,controls,volume,muted,defaultMuted,poster".split(","),
methods = "play,pause,src,load,canPlayType,addTextTrack",
notUsed = "mediaGroup,controller,videoTracks,audioTracks,defaultPlaybackRate";
for (i=0; i < techList.length; i++) {
tech = techList[i];
tname = tech.toLowerCase();
player = _V_("vid"+(i+1), { "techOrder":[tech] });
_V_.each(_V_.html5.events, function(evt){
player.addEvent(evt, _V_.proxy(tname, function(evt){
var eventsId = "#"+this+"_events",
type = evt.type,
prev = $(eventsId+" div").first();
if (prev && prev.html() && prev.html().indexOf(type + " ") === 0) {
var countSpan = prev.children(".count");
countSpan.html(parseInt(countSpan.html() || 1) + 1);
} else {
$("#"+this+"_events").prepend("<div>" + evt.type + " <span class='count'></span></div>");
}
}));
});
var propTable = $("#"+tname+"_props");
_V_.each(props, function(prop){
propTable.append("<tr><th>"+prop+"</th><td id='"+tname+prop+"' class='data'></td></tr>")
});
setInterval(_V_.proxy(player, function(){
_V_.each(props, _V_.proxy(this, function(prop){
var result = ""
try {
result = this[prop]();
if (result === false) result = "false";
if (result === true) result = "true";
if (result === "") result = "''";
if (result === null) result = "<span class='undefined'>null</span>";
if (result === undefined) result = "<span class='undefined'>undefined</span>";
if (typeof result.start == "function") {
var newResult = "", i;
if (result.length > 0) {
for (i=0;i<result.length;i++) {
newResult += "l:"+result.length+" s:"+result.start(i)+" e:"+result.end(i);
}
} else {
newResult = "-";
}
result = newResult;
// result = result.toString();
// result = (result.length > 0) ? "s:"+result.start(0)+" e:"+result.end(0) : "-";
}
} catch(e) {
result = "<span class='na'>N/A</span>";
}
$("#"+this.techName+prop).html(result);
}));
}), 500);
};
});
+8
Ver Arquivo
@@ -0,0 +1,8 @@
Tracking/Polling CurrentTime Manually
-------------------------------------
- Necessary for most flash players and browsers that don't trigger timeupdate events.
- In VJS 1-2, we always tracked time because timeupdate was rare.
- Now most browsers support it well. There is a delay bug in the current Chrome.
http://code.google.com/p/chromium/issues/detail?id=92251
Andrew from Chrome told me it would be fix in an upcoming release.
Going to rely on browsers timeupdates when available now.
Arquivo executável → Arquivo normal
+5 -5
Ver Arquivo
@@ -1,13 +1,13 @@
1
00:00:02,400 --> 00:00:05,200
00:00:00,000 --> 00:00:07,200
[Background Music Playing]
2
00:00:15,712 --> 00:00:17,399
Heay!!
00:00:16,000 --> 00:00:17,200
Welcome to this week's episode
3
00:00:25,712 --> 00:00:30,399
[Bird noises]
00:00:17,400 --> 00:00:19,000
of explore California
-102
Ver Arquivo
@@ -1,102 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>HTML5 Video Player</title>
<!-- Include the VideoJS Library -->
<script src="video.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
// Must come after the video.js library
// Add VideoJS to all video tags on the page when the DOM is ready
VideoJS.setupAllWhenReady();
/* ============= OR ============ */
// Setup and store a reference to the player(s).
// Must happen after the DOM is loaded
// You can use any library's DOM Ready method instead of VideoJS.DOMReady
/*
VideoJS.DOMReady(function(){
// Using the video's ID or element
var myPlayer = VideoJS.setup("example_video_1");
// OR using an array of video elements/IDs
// Note: It returns an array of players
var myManyPlayers = VideoJS.setup(["example_video_1", "example_video_2", video3Element]);
// OR all videos on the page
var myManyPlayers = VideoJS.setup("All");
// After you have references to your players you can...(example)
myPlayer.play(); // Starts playing the video for this player.
});
*/
/* ========= SETTING OPTIONS ========= */
// Set options when setting up the videos. The defaults are shown here.
/*
VideoJS.setupAllWhenReady({
controlsBelow: false, // Display control bar below video instead of in front of
controlsHiding: true, // Hide controls when mouse is not over the video
defaultVolume: 0.85, // Will be overridden by user's last volume if available
flashVersion: 9, // Required flash version for fallback
linksHiding: true // Hide download links when video is supported
});
*/
// Or as the second option of VideoJS.setup
/*
VideoJS.DOMReady(function(){
var myPlayer = VideoJS.setup("example_video_1", {
// Same options
});
});
*/
</script>
<!-- Include the VideoJS Stylesheet -->
<link rel="stylesheet" href="video-js.css" type="text/css" media="screen" title="Video JS">
</head>
<body>
<!-- Begin VideoJS -->
<div class="video-js-box">
<!-- Using the Video for Everybody Embed Code http://camendesign.com/code/video_for_everybody -->
<video id="example_video_1" class="video-js" width="640" height="264" controls="controls" preload="auto" poster="http://video-js.zencoder.com/oceans-clip.png">
<source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
<source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm; codecs="vp8, vorbis"' />
<source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg; codecs="theora, vorbis"' />
<!-- Flash Fallback. Use any flash video player here. Make sure to keep the vjs-flash-fallback class. -->
<object id="flash_fallback_1" class="vjs-flash-fallback" width="640" height="264" type="application/x-shockwave-flash"
data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf">
<param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" />
<param name="wmode" value="opaque" />
<param name="allowfullscreen" value="true" />
<param name="flashvars" value='config={"playlist":["http://video-js.zencoder.com/oceans-clip.png", {"url": "http://video-js.zencoder.com/oceans-clip.mp4","autoPlay":false,"autoBuffering":true}]}' />
<!-- Image Fallback. Typically the same as the poster image. -->
<img src="http://video-js.zencoder.com/oceans-clip.png" width="640" height="264" alt="Poster Image"
title="No video playback capabilities." />
</object>
</video>
<!-- Download links provided for devices that can't play video in the browser. -->
<p class="vjs-no-video"><strong>Download Video:</strong>
<a href="http://video-js.zencoder.com/oceans-clip.mp4">MP4</a>,
<a href="http://video-js.zencoder.com/oceans-clip.webm">WebM</a>,
<a href="http://video-js.zencoder.com/oceans-clip.ogv">Ogg</a><br>
<!-- Support VideoJS by keeping this link. -->
<a href="http://videojs.com">HTML5 Video Player</a> by VideoJS
</p>
</div>
<!-- End VideoJS -->
</body>
</html>
Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 85 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 3.5 KiB

+190
Ver Arquivo
@@ -0,0 +1,190 @@
/* DEFAULT SKIN (override in another file)
================================================================================
Using all CSS to draw the controls. Images could be used if desired.
Instead of editing this file, I recommend creating your own skin CSS file to be included after this file,
so you can upgrade to newer versions easier. */
.vjs-original-skin .vjs-controls {
position: absolute; margin: 0; opacity: 0.85; color: #fff;
display: block; /* Start hidden */
left: 0; right: 0; /* 100% width of video-js-box */
width: 100%;
bottom: 0px; /* Distance from the bottom of the box/video. Keep 0. Use height to add more bottom margin. */
height: 35px; /* Including any margin you want above or below control items */
padding: 0; /* Controls are absolutely position, so no padding necessary */
-webkit-transition: opacity 0.5s linear;
-moz-transition: opacity 0.5s linear;
-o-transition: opacity 0.5s linear;
-ms-transition: opacity 0.5s linear;
transition: opacity 0.5s linear;
}
.vjs-original-skin .vjs-control {
position: absolute; /* Use top, bottom, left, and right to specifically position the control. */
text-align: center; margin: 0; padding: 0;
height: 25px; /* Default height of individual controls */
top: 5px; /* Top margin to put space between video and controls when controls are below */
/* CSS Background Gradients
Using to give the aqua-ish look. */
/* Default */ background-color: #0B151A;
/* Webkit */ background: #1F3744 -webkit-gradient(linear, left top, left bottom, from(#0B151A), to(#1F3744)) left 12px;
/* Firefox */ background: #1F3744 -moz-linear-gradient(top, #0B151A, #1F3744) left 12px;
/* CSS Curved Corners */
-webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px;
/* CSS Shadows */
-webkit-box-shadow: 1px 1px 2px #000; -moz-box-shadow: 1px 1px 2px #000; box-shadow: 1px 1px 2px #000;
}
/* Placement of Control Items
- Left side of pogress bar, use left & width
- Rigth side of progress bar, use right & width
- Expand with the video (like progress bar) use left & right
(using div.x to make more specific than vjs-control style)
*/
.vjs-original-skin div.vjs-play-control { left: 5px; width: 25px; }
.vjs-original-skin div.vjs-progress-control { left: 35px; right: 165px; } /* Using left & right so it expands with the width of the video */
.vjs-original-skin div.vjs-time-control { width: 75px; right: 90px; } /* Time control and progress bar are combined to look like one */
.vjs-original-skin div.vjs-volume-control { width: 50px; right: 35px; }
.vjs-original-skin div.vjs-fullscreen-control { width: 25px; right: 5px; }
/* Removing curved corners on progress control and time control to join them. */
.vjs-original-skin div.vjs-progress-control {
-webkit-border-top-right-radius: 0; -moz-border-radius-topright: 0; border-top-right-radius: 0;
-webkit-border-bottom-right-radius: 0; -moz-border-radius-bottomright: 0; border-bottom-right-radius: 0;
}
.vjs-original-skin div.vjs-time-control {
-webkit-border-top-left-radius: 0; -moz-border-radius-topleft: 0; border-top-left-radius: 0;
-webkit-border-bottom-left-radius: 0; -moz-border-radius-bottomleft: 0; border-bottom-left-radius: 0;
}
/* Play/Pause
-------------------------------------------------------------------------------- */
.vjs-original-skin .vjs-play-control { cursor: pointer !important; }
/* Play Icon */
.vjs-original-skin .vjs-play-control span { display: block; font-size: 0; line-height: 0; }
.vjs-original-skin.vjs-paused .vjs-play-control span {
width: 0; height: 0; margin: 8px 0 0 8px;
/* Drawing the play triangle with borders - http://www.infimum.dk/HTML/slantinfo.html */
border-left: 10px solid #fff; /* Width & Color of play icon */
/* Height of play icon is total top & bottom border widths. Color is transparent. */
border-top: 5px solid rgba(0,0,0,0); border-bottom: 5px solid rgba(0,0,0,0);
}
.vjs-original-skin.vjs-playing .vjs-play-control span {
width: 3px; height: 10px; margin: 8px auto 0;
/* Drawing the pause bars with borders */
border-top: 0px; border-left: 3px solid #fff; border-bottom: 0px; border-right: 3px solid #fff;
}
/* Progress
-------------------------------------------------------------------------------- */
.vjs-original-skin .vjs-progress-holder { /* Box containing play and load progresses */
position: relative; padding: 0; overflow:hidden; cursor: pointer !important;
height: 9px; border: 1px solid #777;
margin: 7px 1px 0 5px; /* Placement within the progress control item */
-webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px;
}
.vjs-original-skin .vjs-progress-holder div { /* Progress Bars */
position: absolute; display: block; width: 0; height: 9px; margin: 0; padding: 0;
left: 0; top: 0; /*Needed for IE6*/
-webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px;
}
.vjs-original-skin .vjs-play-progress {
/* CSS Gradient */
/* Default */ background: #fff;
/* Webkit */ background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#777));
/* Firefox */ background: -moz-linear-gradient(top, #fff, #777);
}
.vjs-original-skin .vjs-load-progress {
opacity: 0.8;
/* CSS Gradient */
/* Default */ background-color: #555;
/* Webkit */ background: -webkit-gradient(linear, left top, left bottom, from(#555), to(#aaa));
/* Firefox */ background: -moz-linear-gradient(top, #555, #aaa);
}
/* Time Display
-------------------------------------------------------------------------------- */
.vjs-original-skin .vjs-time-control { font-size: 10px; line-height: 1; font-weight: normal; font-family: Helvetica, Arial, sans-serif; }
.vjs-original-skin .vjs-time-control span { line-height: 25px; /* Centering vertically */ }
/* Volume
-------------------------------------------------------------------------------- */
.vjs-original-skin .vjs-volume-control { cursor: pointer !important; }
.vjs-original-skin .vjs-volume-control div { display: block; margin: 0 5px 0 5px; padding: 4px 0 0 0; }
/* Drawing the volume icon using 6 span elements */
.vjs-original-skin .vjs-volume-control div span { /* Individual volume bars */
float: left; padding: 0; font-size: 0; line-height: 0;
margin: 0 2px 0 0; /* Space between */
width: 5px; height: 0px; /* Total height is height + bottom border */
border-bottom: 18px solid #555; /* Default (off) color and height of visible portion */
}
.vjs-original-skin .vjs-volume-control div span.vjs-volume-level-on { border-color: #fff; /* Volume on bar color */ }
/* Creating differnt bar heights through height (transparent) and bottom border (visible). */
.vjs-original-skin .vjs-volume-control div span.vjs-vc-1 { border-bottom-width: 2px; height: 16px; }
.vjs-original-skin .vjs-volume-control div span.vjs-vc-2 { border-bottom-width: 4px; height: 14px; }
.vjs-original-skin .vjs-volume-control div span.vjs-vc-3 { border-bottom-width: 7px; height: 11px; }
.vjs-original-skin .vjs-volume-control div span.vjs-vc-4 { border-bottom-width: 10px; height: 8px; }
.vjs-original-skin .vjs-volume-control div span.vjs-vc-5 { border-bottom-width: 14px; height: 4px; }
.vjs-original-skin .vjs-volume-control div span.vjs-vc-6 { margin-right: 0; }
/* Fullscreen
-------------------------------------------------------------------------------- */
.vjs-original-skin .vjs-fullscreen-control { cursor: pointer !important; }
.vjs-original-skin .vjs-fullscreen-control div {
padding: 0; text-align: left; vertical-align: top; cursor: pointer !important;
margin: 5px 0 0 5px; /* Placement within the fullscreen control item */
width: 20px; height: 20px;
}
/* Drawing the fullscreen icon using 4 span elements */
.vjs-original-skin .vjs-fullscreen-control div span { float: left; margin: 0; padding: 0; font-size: 0; line-height: 0; width: 0; text-align: left; vertical-align: top; }
.vjs-original-skin .vjs-fullscreen-control div span.vjs-fc-1 { /* Top-left triangle */
margin-right: 3px; /* Space between top-left and top-right */
margin-bottom: 3px; /* Space between top-left and bottom-left */
border-top: 6px solid #fff; /* Height and color */
border-right: 6px solid rgba(0,0,0,0); /* Width */
}
.vjs-original-skin .vjs-fullscreen-control div span.vjs-fc-2 { border-top: 6px solid #fff; border-left: 6px solid rgba(0,0,0,0); }
.vjs-original-skin .vjs-fullscreen-control div span.vjs-fc-3 { clear: both; margin: 0 3px 0 0; border-bottom: 6px solid #fff; border-right: 6px solid rgba(0,0,0,0); }
.vjs-original-skin .vjs-fullscreen-control div span.vjs-fc-4 { border-bottom: 6px solid #fff; border-left: 6px solid rgba(0,0,0,0); }
/* Icon when video is in fullscreen mode */
.vjs-original-skin.vjs-fullscreen .vjs-fullscreen-control div span.vjs-fc-1 { border: none; border-bottom: 6px solid #fff; border-left: 6px solid rgba(0,0,0,0); }
.vjs-original-skin.vjs-fullscreen .vjs-fullscreen-control div span.vjs-fc-2 { border: none; border-bottom: 6px solid #fff; border-right: 6px solid rgba(0,0,0,0); }
.vjs-original-skin.vjs-fullscreen .vjs-fullscreen-control div span.vjs-fc-3 { border: none; border-top: 6px solid #fff; border-left: 6px solid rgba(0,0,0,0); }
.vjs-original-skin.vjs-fullscreen .vjs-fullscreen-control div span.vjs-fc-4 { border: none; border-top: 6px solid #fff; border-right: 6px solid rgba(0,0,0,0); }
/* Big Play Button (at start)
---------------------------------------------------------*/
.vjs-original-skin .vjs-big-play-button {
display: block; /* Start hidden */ z-index: 2;
position: absolute; top: 50%; left: 50%; width: 80px; height: 80px; margin: -43px 0 0 -43px; text-align: center; vertical-align: center; cursor: pointer !important;
border: 3px solid #fff; opacity: 0.9;
-webkit-border-radius: 20px; -moz-border-radius: 20px; border-radius: 20px;
/* CSS Background Gradients */
/* Default */ background-color: #0B151A;
/* Webkit */ background: #1F3744 -webkit-gradient(linear, left top, left bottom, from(#0B151A), to(#1F3744)) left 40px;
/* Firefox */ background: #1F3744 -moz-linear-gradient(top, #0B151A, #1F3744) left 40px;
/* CSS Shadows */
-webkit-box-shadow: 4px 4px 8px #000; -moz-box-shadow: 4px 4px 8px #000; box-shadow: 4px 4px 8px #000;
}
.vjs-original-skin div.vjs-big-play-button:hover {
-webkit-box-shadow: 0px 0px 80px #fff; -moz-box-shadow: 0px 0px 80px #fff; box-shadow: 0px 0px 80px #fff;
}
.vjs-original-skin div.vjs-big-play-button span {
display: block; font-size: 0; line-height: 0;
width: 0; height: 0; margin: 20px 0 0 23px;
/* Drawing the play triangle with borders - http://www.infimum.dk/HTML/slantinfo.html */
border-left: 40px solid #fff; /* Width & Color of play icon */
/* Height of play icon is total top & bottom border widths. Color is transparent. */
border-top: 20px solid rgba(0,0,0,0); border-bottom: 20px solid rgba(0,0,0,0);
}
+405
Ver Arquivo
@@ -0,0 +1,405 @@
/*
VideoJS Default Styles (http://videojs.com)
Version 3.0
REQUIRED STYLES (be careful overriding)
================================================================================ */
/* When loading the player, the video tag is replaced with a DIV,
that will hold the video tag or object tag for other playback methods.
The div contains the video playback element (Flash or HTML5) and controls, and sets the width and height of the video.
** If you want to add some kind of border/padding (e.g. a frame), or special positioning, use another containing element.
Otherwise you risk messing up control positioning and full window mode. **
*/
.video-js {
background-color: #000; position: relative; padding: 0;
/* Start with 10px for base font size so other dimensions can be em based and easily calculable. */
font-size: 10px;
/* Allow poster to be vertially aligned. */
vertical-align: middle;
/* display: table-cell; */ /*This works in Safari but not Firefox.*/
}
/* Playback technology elements expand to the width/height of the containing div. <video> or <object> */
.video-js .vjs-tech { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
/* Fullscreen Styles */
body.vjs-full-window {
padding: 0; margin: 0;
height: 100%; overflow-y: auto; /* Fix for IE6 full-window. http://www.cssplay.co.uk/layouts/fixed.html */
}
.video-js.vjs-fullscreen {
position: fixed; overflow: hidden; z-index: 1000; left: 0; top: 0; bottom: 0; right: 0; width: 100% !important; height: 100% !important;
_position: absolute; /* IE6 Full-window (underscore hack) */
}
.video-js:-webkit-full-screen {
width: 100% !important; height: 100% !important;
}
/* Poster Styles */
.vjs-poster {
margin: 0 auto; padding: 0; cursor: pointer;
/* Scale with the size of the player div. Works when poster is vertically shorter, but stretches when it's less wide. */
position: relative; width: 100%; max-height: 100%;
}
/* Subtiles Styles */
.video-js .vjs-subtitles { color: #fff; font-size: 20px; text-align: center; position: absolute; bottom: 40px; left: 0; right: 0; }
/* DEFAULT SKIN (override in another file to create new skins)
================================================================================
Instead of editing this file, I recommend creating your own skin CSS file to be included after this file,
so you can upgrade to newer versions easier. You can remove all these styles by removing the 'vjs-default-skin' class from the tag. */
/* The default control bar. Created by bar.js */
.vjs-default-skin .vjs-controls {
position: absolute;
bottom: 0; /* Distance from the bottom of the box/video. Keep 0. Use height to add more bottom margin. */
left: 0; right: 0; /* 100% width of div */
opacity: 0.85;
display: none; /* Start hidden */
margin: 0; padding: 0; /* Controls are absolutely position, so no padding necessary */
height: 2.6em; /* Including any margin you want above or below control items */
color: #fff; border-top: 1px solid #404040;
/* CSS Gradient */
/* Can use the Ultimate CSS Gradient Generator: http://www.colorzilla.com/gradient-editor/ */
background: #242424; /* Old browsers */
background: -moz-linear-gradient(top, #242424 50%, #1f1f1f 50%, #171717 100%); /* FF3.6+ */
background: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(50%,#242424), color-stop(50%,#1f1f1f), color-stop(100%,#171717)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #242424 50%,#1f1f1f 50%,#171717 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #242424 50%,#1f1f1f 50%,#171717 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #242424 50%,#1f1f1f 50%,#171717 100%); /* IE10+ */
/* Filter was causing a lot of weird issues in IE. Elements would stop showing up, or other styles would break. */
/*filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#242424', endColorstr='#171717',GradientType=0 );*/ /* IE6-9 */
background: linear-gradient(top, #242424 50%,#1f1f1f 50%,#171717 100%); /* W3C */
/* Fade-in using CSS Transitions */
-webkit-transition: opacity 0.3s linear;
-moz-transition: opacity 0.3s linear;
-o-transition: opacity 0.3s linear;
-ms-transition: opacity 0.3s linear;
transition: opacity 0.3s linear;
}
/* General styles for individual controls. */
.vjs-default-skin .vjs-control {
position: relative; float: left;
text-align: center; margin: 0; padding: 0;
height: 2.6em; width: 2.6em;
}
.vjs-default-skin .vjs-control:focus {
outline: 0;
}
/* Hide control text visually, but have it available for screenreaders: h5bp.com/v */
.vjs-default-skin .vjs-control-text { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
/* Play/Pause
-------------------------------------------------------------------------------- */
.vjs-default-skin .vjs-play-control { width: 5em; cursor: pointer !important; }
/* Play Icon */
.vjs-default-skin.vjs-paused .vjs-play-control div { width: 15px; height: 17px; background: url('video-js.png'); margin: 0.5em auto 0; }
.vjs-default-skin.vjs-playing .vjs-play-control div { width: 15px; height: 17px; background: url('video-js.png') -25px 0; margin: 0.5em auto 0; }
/* Rewind
-------------------------------------------------------------------------------- */
.vjs-default-skin .vjs-rewind-control { width: 5em; cursor: pointer !important; }
.vjs-default-skin .vjs-rewind-control div { width: 19px; height: 16px; background: url('video-js.png'); margin: 0.5em auto 0; }
/* Volume/Mute
-------------------------------------------------------------------------------- */
.vjs-default-skin .vjs-mute-control { width: 3.8em; cursor: pointer !important; float: right; }
.vjs-default-skin .vjs-mute-control div { width: 22px; height: 16px; background: url('video-js.png') -75px -25px; margin: 0.5em auto 0; }
.vjs-default-skin .vjs-mute-control.vjs-vol-0 div { background: url('video-js.png') 0 -25px; }
.vjs-default-skin .vjs-mute-control.vjs-vol-1 div { background: url('video-js.png') -25px -25px; }
.vjs-default-skin .vjs-mute-control.vjs-vol-2 div { background: url('video-js.png') -50px -25px; }
.vjs-default-skin .vjs-volume-control { width: 5em; float: right; }
.vjs-default-skin .vjs-volume-bar {
position: relative; width: 5em; height: 0.6em; margin: 1em auto 0; cursor: pointer !important;
-moz-border-radius: 0.3em; -webkit-border-radius: 0.3em; border-radius: 0.3em;
background: #666;
background: -moz-linear-gradient(top, #333, #666);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#333), to(#666));
background: -webkit-linear-gradient(top, #333, #666);
background: -o-linear-gradient(top, #333, #666);
background: -ms-linear-gradient(top, #333, #666);
background: linear-gradient(top, #333, #666);
}
.vjs-default-skin .vjs-volume-level {
position: absolute; top: 0; left: 0; height: 0.6em;
-moz-border-radius: 0.3em; -webkit-border-radius: 0.3em; border-radius: 0.3em;
background: #fff;
background: -moz-linear-gradient(top, #fff, #ccc);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ccc));
background: -webkit-linear-gradient(top, #fff, #ccc);
background: -o-linear-gradient(top, #fff, #ccc);
background: -ms-linear-gradient(top, #fff, #ccc);
background: linear-gradient(top, #fff, #ccc);
}
.vjs-default-skin .vjs-volume-handle {
position: absolute; top: -0.2em; width: 0.8em; height: 0.8em; background: #ccc; left: 0;
border: 1px solid #fff;
-moz-border-radius: 0.6em; -webkit-border-radius: 0.6em; border-radius: 0.6em;
}
/* Progress
-------------------------------------------------------------------------------- */
.vjs-default-skin div.vjs-progress-control {
position: absolute;
left: 4.8em; right: 4.8em; /* Leave room for time displays. */
height: 1.0em; width: auto;
top: -1.3em; /* Set above the rest of the controls. And leave room for 2px of borders (progress bottom and controls top). */
border-bottom: 1px solid #1F1F1F;
border-top: 1px solid #222;
/* CSS Gradient */
background: #333;
background: -moz-linear-gradient(top, #222, #333);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#222), to(#333));
background: -webkit-linear-gradient(top, #222, #333);
background: -o-linear-gradient(top, #333, #222);
background: -ms-linear-gradient(top, #333, #222);
background: linear-gradient(top, #333, #222);
/* 1px top shadow */
/* -webkit-box-shadow: 0px -1px 0px 0px rgba(0, 0, 0, 0.15); -moz-box-shadow: 0px -1px 0px 0px rgba(0, 0, 0, 0.15); box-shadow: 0px -1px 0px 0px rgba(0, 0, 0, 0.15);*/
}
/* Box containing play and load progresses. Also acts as seek scrubber. */
.vjs-default-skin .vjs-progress-holder {
position: relative; cursor: pointer !important; /*overflow: hidden;*/
padding: 0; margin: 0; /* Placement within the progress control item */
height: 1.0em;
-moz-border-radius: 0.6em; -webkit-border-radius: 0.6em; border-radius: 0.6em;
/* CSS Gradient */
background: #111;
background: -moz-linear-gradient(top, #111, #262626);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#111), to(#262626));
background: -webkit-linear-gradient(top, #111, #262626);
background: -o-linear-gradient(top, #111, #262626);
background: -ms-linear-gradient(top, #111, #262626);
background: linear-gradient(top, #111, #262626);
}
.vjs-default-skin .vjs-progress-holder .vjs-play-progress,
.vjs-default-skin .vjs-progress-holder .vjs-load-progress { /* Progress Bars */
position: absolute; display: block; height: 1.0em; margin: 0; padding: 0;
left: 0; top: 0; /*Needed for IE6*/
-moz-border-radius: 0.6em; -webkit-border-radius: 0.6em; border-radius: 0.6em;
/*width: 0;*/
}
.vjs-default-skin .vjs-play-progress {
/* CSS Gradient. */
background: #fff; /* Old browsers */
background: -moz-linear-gradient(top, #fff 0%, #d6d6d6 50%, #fff 100%);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(0%,#fff), color-stop(50%,#d6d6d6), color-stop(100%,#fff));
background: -webkit-linear-gradient(top, #fff 0%,#d6d6d6 50%,#fff 100%);
background: -o-linear-gradient(top, #fff 0%,#d6d6d6 50%,#fff 100%);
background: -ms-linear-gradient(top, #fff 0%,#d6d6d6 50%,#fff 100%);
background: linear-gradient(top, #fff 0%,#d6d6d6 50%,#fff 100%);
background: #efefef;
background: -moz-linear-gradient(top, #efefef 0%, #f5f5f5 50%, #dbdbdb 50%, #f1f1f1 100%);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(0%,#efefef), color-stop(50%,#f5f5f5), color-stop(50%,#dbdbdb), color-stop(100%,#f1f1f1));
background: -webkit-linear-gradient(top, #efefef 0%,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);
background: -o-linear-gradient(top, #efefef 0%,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);
background: -ms-linear-gradient(top, #efefef 0%,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#efefef', endColorstr='#f1f1f1',GradientType=0 );
background: linear-gradient(top, #efefef 0%,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);
}
.vjs-default-skin .vjs-load-progress {
opacity: 0.8;
/* CSS Gradient */
background: #666;
background: -moz-linear-gradient(top, #666, #333);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#666), to(#333));
background: -webkit-linear-gradient(top, #666, #333);
background: -o-linear-gradient(top, #666, #333);
background: -ms-linear-gradient(top, #666, #333);
background: linear-gradient(top, #666, #333);
}
.vjs-default-skin div.vjs-seek-handle {
position: absolute;
width: 16px; height: 16px; /* Match img pixles */
margin-top: -0.3em;
left: 0; top: 0; /*Needed for IE6*/
background: url('video-js.png') 0 -50px;
/* CSS Curved Corners. Needed to make shadows curved. */
-moz-border-radius: 0.8em; -webkit-border-radius: 0.8em; border-radius: 0.8em;
/* CSS Shadows */
-webkit-box-shadow: 0 2px 4px 0 #000; -moz-box-shadow: 0 2px 4px 0 #000; box-shadow: 0 2px 4px 0 #000;
}
/* Time Display
-------------------------------------------------------------------------------- */
.vjs-default-skin .vjs-time-controls {
position: absolute;
right: 0;
height: 1.0em; width: 4.8em;
top: -1.3em;
border-bottom: 1px solid #1F1F1F;
border-top: 1px solid #222;
background-color: #333;
font-size: 1em; line-height: 1.0em; font-weight: normal; font-family: Helvetica, Arial, sans-serif;
background: #333;
background: -moz-linear-gradient(top, #222, #333);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#222), to(#333));
background: -webkit-linear-gradient(top, #222, #333);
background: -o-linear-gradient(top, #333, #222);
background: -ms-linear-gradient(top, #333, #222);
background: linear-gradient(top, #333, #222);
/* 1px top shadow */
/* -webkit-box-shadow: 0px -1px 0px 0px rgba(0, 0, 0, 0.15); -moz-box-shadow: 0px -1px 0px 0px rgba(0, 0, 0, 0.15); box-shadow: 0px -1px 0px 0px rgba(0, 0, 0, 0.15);*/
}
.vjs-default-skin .vjs-current-time { left: 0; }
.vjs-default-skin .vjs-duration { right: 0; display: none; }
.vjs-default-skin .vjs-remaining-time { right: 0; }
.vjs-time-divider { display:none; }
.vjs-default-skin .vjs-time-control { font-size: 1em; line-height: 1; font-weight: normal; font-family: Helvetica, Arial, sans-serif; }
.vjs-default-skin .vjs-time-control span { line-height: 25px; /* Centering vertically */ }
/* Fullscreen
-------------------------------------------------------------------------------- */
.vjs-secondary-controls { float: right; }
.vjs-default-skin .vjs-fullscreen-control { width: 3.8em; cursor: pointer !important; float: right; }
.vjs-default-skin .vjs-fullscreen-control div { width: 16px; height: 16px; background: url('video-js.png') -50px 0; margin: 0.5em auto 0; }
.vjs-default-skin.vjs-fullscreen .vjs-fullscreen-control div { background: url('video-js.png') -75px 0; }
/* Big Play Button (at start)
---------------------------------------------------------*/
.vjs-default-skin .vjs-big-play-button {
display: block; /* Start hidden */ z-index: 2;
position: absolute; top: 50%; left: 50%; width: 8.0em; height: 8.0em; margin: -43px 0 0 -43px; text-align: center; vertical-align: center; cursor: pointer !important;
border: 0.3em solid #fff; opacity: 0.95;
-webkit-border-radius: 25px; -moz-border-radius: 25px; border-radius: 25px;
background: #454545;
background: -moz-linear-gradient(top, #454545 0%, #232323 50%, #161616 50%, #3f3f3f 100%);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(0%,#454545), color-stop(50%,#232323), color-stop(50%,#161616), color-stop(100%,#3f3f3f));
background: -webkit-linear-gradient(top, #454545 0%,#232323 50%,#161616 50%,#3f3f3f 100%);
background: -o-linear-gradient(top, #454545 0%,#232323 50%,#161616 50%,#3f3f3f 100%);
background: -ms-linear-gradient(top, #454545 0%,#232323 50%,#161616 50%,#3f3f3f 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#454545', endColorstr='#3f3f3f',GradientType=0 );
background: linear-gradient(top, #454545 0%,#232323 50%,#161616 50%,#3f3f3f 100%);
/* CSS Shadows */
-webkit-box-shadow: 4px 4px 8px #000; -moz-box-shadow: 4px 4px 8px #000; box-shadow: 4px 4px 8px #000;
}
.vjs-default-skin div.vjs-big-play-button:hover {
-webkit-box-shadow: 0 0 80px #fff; -moz-box-shadow: 0 0 80px #fff; box-shadow: 0 0 80px #fff;
}
.vjs-default-skin div.vjs-big-play-button span {
position: absolute; top: 50%; left: 50%;
display: block; width: 35px; height: 42px;
margin: -20px 0 0 -15px; /* Using negative margin to center image. */
background: url('video-js.png') -100px 0;
}
/* Loading Spinner
---------------------------------------------------------*/
/* CSS Spinners by Kilian Valkhof - http://kilianvalkhof.com/2010/css-xhtml/css3-loading-spinners-without-images/ */
.vjs-loading-spinner {
display: none;
position: absolute; top: 50%; left: 50%; width: 55px; height: 55px;
margin: -28px 0 0 -28px;
-webkit-animation-name: rotatethis;
-webkit-animation-duration:1s;
-webkit-animation-iteration-count:infinite;
-webkit-animation-timing-function:linear;
-moz-animation-name: rotatethis;
-moz-animation-duration:1s;
-moz-animation-iteration-count:infinite;
-moz-animation-timing-function:linear;
}
@-webkit-keyframes rotatethis {
0% {-webkit-transform:scale(0.6) rotate(0deg); }
12.5% {-webkit-transform:scale(0.6) rotate(0deg); }
12.51% {-webkit-transform:scale(0.6) rotate(45deg); }
25% {-webkit-transform:scale(0.6) rotate(45deg); }
25.01% {-webkit-transform:scale(0.6) rotate(90deg);}
37.5% {-webkit-transform:scale(0.6) rotate(90deg);}
37.51% {-webkit-transform:scale(0.6) rotate(135deg);}
50% {-webkit-transform:scale(0.6) rotate(135deg);}
50.01% {-webkit-transform:scale(0.6) rotate(180deg);}
62.5% {-webkit-transform:scale(0.6) rotate(180deg);}
62.51% {-webkit-transform:scale(0.6) rotate(225deg);}
75% {-webkit-transform:scale(0.6) rotate(225deg);}
75.01% {-webkit-transform:scale(0.6) rotate(270deg);}
87.5% {-webkit-transform:scale(0.6) rotate(270deg);}
87.51% {-webkit-transform:scale(0.6) rotate(315deg);}
100% {-webkit-transform:scale(0.6) rotate(315deg);}
}
@-moz-keyframes rotatethis {
0% {-moz-transform:scale(0.6) rotate(0deg);}
12.5% {-moz-transform:scale(0.6) rotate(0deg);}
12.51% {-moz-transform:scale(0.6) rotate(45deg);}
25% {-moz-transform:scale(0.6) rotate(45deg);}
25.01% {-moz-transform:scale(0.6) rotate(90deg);}
37.5% {-moz-transform:scale(0.6) rotate(90deg);}
37.51% {-moz-transform:scale(0.6) rotate(135deg);}
50% {-moz-transform:scale(0.6) rotate(135deg);}
50.01% {-moz-transform:scale(0.6) rotate(180deg);}
62.5% {-moz-transform:scale(0.6) rotate(180deg);}
62.51% {-moz-transform:scale(0.6) rotate(225deg);}
75% {-moz-transform:scale(0.6) rotate(225deg);}
75.01% {-moz-transform:scale(0.6) rotate(270deg);}
87.5% {-moz-transform:scale(0.6) rotate(270deg);}
87.51% {-moz-transform:scale(0.6) rotate(315deg);}
100% {-moz-transform:scale(0.6) rotate(315deg);}
}
/* Each circle */
div.vjs-loading-spinner .ball1 { opacity: 0.12; position:absolute; left: 20px; top: 0px; width: 13px; height: 13px; background: #fff;
border-radius: 13px; -webkit-border-radius: 13px; -moz-border-radius: 13px; border: 1px solid #ccc; }
div.vjs-loading-spinner .ball2 { opacity: 0.25; position:absolute; left: 34px; top: 6px; width: 13px; height: 13px; background: #fff;
border-radius: 13px; -webkit-border-radius: 13px; -moz-border-radius: 13px; border: 1px solid #ccc; }
div.vjs-loading-spinner .ball3 { opacity: 0.37; position:absolute; left: 40px; top: 20px; width: 13px; height: 13px; background: #fff;
border-radius: 13px; -webkit-border-radius: 13px; -moz-border-radius: 13px; border: 1px solid #ccc; }
div.vjs-loading-spinner .ball4 { opacity: 0.50; position:absolute; left: 34px; top: 34px; width: 13px; height: 13px; background: #fff;
border-radius: 10px; -webkit-border-radius: 10px; -moz-border-radius: 15px; border: 1px solid #ccc; }
div.vjs-loading-spinner .ball5 { opacity: 0.62; position:absolute; left: 20px; top: 40px; width: 13px; height: 13px; background: #fff;
border-radius: 13px; -webkit-border-radius: 13px; -moz-border-radius: 13px; border: 1px solid #ccc; }
div.vjs-loading-spinner .ball6 { opacity: 0.75; position:absolute; left: 6px; top: 34px; width: 13px; height: 13px; background: #fff;
border-radius: 13px; -webkit-border-radius: 13px; -moz-border-radius: 13px; border: 1px solid #ccc; }
div.vjs-loading-spinner .ball7 { opacity: 0.87; position:absolute; left: 0px; top: 20px; width: 13px; height: 13px; background: #fff;
border-radius: 13px; -webkit-border-radius: 13px; -moz-border-radius: 13px; border: 1px solid #ccc; }
div.vjs-loading-spinner .ball8 { opacity: 1.00; position:absolute; left: 6px; top: 6px; width: 13px; height: 13px; background: #fff;
border-radius: 13px; -webkit-border-radius: 13px; -moz-border-radius: 13px; border: 1px solid #ccc; }
Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 7.3 KiB

+53
Ver Arquivo
@@ -0,0 +1,53 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>HTML5 Video Player</title>
<link href="design/video-js.css" rel="stylesheet" type="text/css">
<!--[if IE]>
<script src="https://getfirebug.com/releases/lite/1.3/firebug-lite.js"></script>
<!--<![endif]-->
<script src="src/core.js"></script>
<script src="src/lib.js"></script>
<script src="src/ecma.js"></script>
<script src="src/json.js"></script>
<script src="src/component.js"></script>
<script src="src/player.js"></script>
<script src="src/tech.js"></script>
<script src="src/controls.js"></script>
<script src="src/events.js"></script>
<script src="src/tracks.js"></script>
<script src="flash/swfobject.js"></script>
<script src="src/setup.js"></script>
<script type="text/javascript" charset="utf-8">
// Easy access to test Flash over HTML5. Add ?flash to URL
if (window.location.href.indexOf("?flash") !== -1) {
_V_.options.techOrder = ["H5swf"]
}
</script>
</head>
<body>
<video id="vid1" class="video-js vjs-default-skin" controls preload="auto" width="640" height="264"
poster="http://video-js.zencoder.com/oceans-clip.png"
data-setup='{}'>
<source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4'>
<source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm'>
<source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg'>
<p>Video Playback Not Supported</p>
</video>
<script>
vid = document.getElementById("vid1");
</script>
</body>
</html>
+17
Ver Arquivo
@@ -0,0 +1,17 @@
#! /usr/bin/env ruby
# Create javascript file with list of source files for easy inclusion in other development files.
# puts ARGV[0]
File.open("source-list.js", "w+") do |file|
file.puts "var vjsSourceList = [];"
Dir.foreach('../src') do |item|
next if item == '.' or item == '..' or item == '.DS_Store'
file.puts "vjsSourceList.push('src/#{item}')"
end
end
-13
Ver Arquivo
@@ -1,13 +0,0 @@
#! /bin/csh
# Combines Source Files. In terminal, sh combine_sources.sh
cat src/_begin.js > combined.js
cat src/main.js >> combined.js
cat src/api.js >> combined.js
cat src/html5.js >> combined.js
cat src/flash.js >> combined.js
cat src/behaviors.js >> combined.js
cat src/lib.js >> combined.js
cat src/video-js.jquery.js >> combined.js
cat src/_end.js >> combined.js
Diff do arquivo suprimido porque uma ou mais linhas são muito longas
-114
Ver Arquivo
@@ -1,114 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>HTML5 Video Player: flowplayer</title>
<!-- Include the VideoJS Library -->
<script src="../src/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/api.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/html5.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/flash.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/behaviors.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/lib.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/video-js.jquery.js" type="text/javascript" charset="utf-8"></script>
<!-- <script type="text/javascript" src="flowplayer-3.2.4.min.js"></script> -->
<script type="text/javascript" src="video-js.flowplayer.js"></script>
<script type="text/javascript">
VideoJS.DOMReady(function(){
myPlayer = VideoJS.setup("example_video_1", {
controlsHiding: true,
controlsBelow: false,
showControlsAtStart: true,
playerFallbackOrder: ["flash", "html5", "links"]
});
myPlayer.activateElement(document.getElementById("scrub"), "loadProgressBar");
// var vid = document.getElementById("example_video_1"),
// attrTable = document.getElementById("attributes"),
// attrNames = ["error", "networkState", "readyState", "preload", "buffered",
// "seeking", "currentTime", "initialTime", "duration", "startOffsetTime",
// "paused", "defaultPlaybackRate", "playbackRate", "played", "seekable",
// "ended", "autoplay", "loop", "controls", "volume", "muted", "tracks"
// ],
// attrs = {};
//
// for(var i=0,j=attrNames.length; i<j; i++) {
// var row = _V_.createElement("tr");
// var th = _V_.createElement("th");
// th.innerHTML = attrNames[i];
// attrs[attrNames[i]] = _V_.createElement("td", { id: attrNames[i] });
// row.appendChild(th); row.appendChild(attrs[attrNames[i]]);
// attrTable.appendChild(row);
// }
//
// setInterval(function(){
// for(var i=0,j=attrNames.length; i<j; i++) {
// attrs[attrNames[i]].innerHTML = vid[attrNames[i]];
// }
// }, 100);
//
// var events = ["loadstart","progress","suspend","abort","error","emptied","stalled","play","pause",
// "loadedmetadata", "loadeddata", "waiting", "playing", "canplay", "canplaythrough", "seeking", "seeked",
// // "timeupdate",
// "ended", "ratechange", "durationchange","volumechange"
// ],
// eventsList = document.getElementById("events");
//
// for(var i=0,j=events.length; i<j; i++) {
// vid.addEventListener(events[i], function(){
// eventsList.innerHTML = this + "\n" + eventsList.innerHTML
// }.context(events[i]), false);
// }
});
</script>
<style type="text/css" media="screen">
#attributes { width: 300px; float: left; }
#events { width: 300px; height: 500px; float: left; }
</style>
<!-- Include the VideoJS Stylesheet -->
<link rel="stylesheet" href="../../video-js.css" type="text/css" media="screen" title="Video JS">
<link rel="stylesheet" href="../../skins/tube.css" type="text/css" media="screen" title="Video JS">
<link rel="stylesheet" href="../../skins/hu.css" type="text/css" media="screen" title="Video JS">
<link rel="stylesheet" href="../../skins/vim.css" type="text/css" media="screen" title="Video JS">
</head>
<body>
<!-- Begin VideoJS -->
<div id="scrub" style="background: #000; height: 10px;"></div>
<div class="video-js-box">
<!-- Using the Video for Everybody Embed Code http://camendesign.com/code/video_for_everybody -->
<video id="example_video_1" class="video-js" width="640" height="264" controls="controls" preload="auto" poster="http://video-js.zencoder.com/oceans-clip.png">
<source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
<source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm; codecs="vp8, vorbis"' />
<source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg; codecs="theora, vorbis"' />
<!-- <track kind="subtitles" src="../demo-subtitles.srt" srclang="en-US" label="English"></track> -->
<!-- Flash Fallback. Use any flash video player here. Make sure to keep the vjs-flash-fallback class. -->
<div class="vjs-flash-fallback" width="640" height="264" href="http://video-js.zencoder.com/oceans-clip.mp4"></div>
</video>
<!-- Download links provided for devices that can't play video in the browser. -->
<p class="vjs-no-video"><strong>Download Video:</strong>
<a href="http://video-js.zencoder.com/oceans-clip.mp4">MP4</a>,
<a href="http://video-js.zencoder.com/oceans-clip.webm">WebM</a>,
<a href="http://video-js.zencoder.com/oceans-clip.ogv">Ogg</a><br>
<!-- Support VideoJS by keeping this link. -->
<a href="http://videojs.com">HTML5 Video Player</a> by VideoJS
</p>
</div>
<!-- End VideoJS -->
<a onClick="(function(){document.getElementById('example_video_1').player.flowplayer.play(); return false;})()">Click</a>
<table id="attributes">
</table>
<textarea id="events"></textarea>
</body>
</html>
Ver Arquivo
-13
Ver Arquivo
@@ -1,13 +0,0 @@
1
00:00:02,400 --> 00:00:05,200
41.586688,-100.112915
2
00:00:15,712 --> 00:00:17,399
46.920255,3.010254
3
00:00:25,712 --> 00:00:30,399
-36.208823,-67.192383
-92
Ver Arquivo
@@ -1,92 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>HTML5 Video Player</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<!-- Include the VideoJS Library -->
<script src="../../video.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
VideoJS.DOMReady(function(){
var myPlayer = VideoJS.setup("example_video_1", { controlsHiding: false });
});
</script>
<script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">
function initialize() {
var latlng = new google.maps.LatLng(-34.397, 150.644);
var myOptions = {
zoom: 8,
center: latlng,
disableDefaultUI: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
setTimeout(function() { map.panTo(new google.maps.LatLng(37.4419, -122.1419), 13) }, 2000)
}
</script>
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px }
#map_canvas { height: 100%; position: absolute; top: 0; left: 0; }
.video-js-box { position: absolute; top: 50%; left: 50%; z-index: 1; margin: -132px 0 0 -320px; }
</style>
<style type="text/css" media="screen">
#attributes { width: 300px; float: left; }
#events { width: 300px; height: 500px; float: left; }
</style>
<!-- Include the VideoJS Stylesheet -->
<link rel="stylesheet" href="../../video-js.css" type="text/css" media="screen" title="Video JS">
<link rel="stylesheet" href="../skins/tube.css" type="text/css" media="screen" title="Video JS">
<link rel="stylesheet" href="../skins/hu.css" type="text/css" media="screen" title="Video JS">
<link rel="stylesheet" href="../skins/vim.css" type="text/css" media="screen" title="Video JS">
</head>
<body onload="initialize()">
<!-- Begin VideoJS -->
<div class="video-js-box">
<!-- Using the Video for Everybody Embed Code http://camendesign.com/code/video_for_everybody -->
<video data-subtitles="../demo-subtitles.srt" id="example_video_1" class="video-js" width="640" height="264" controls="controls" preload="auto" poster="http://video-js.zencoder.com/oceans-clip.png">
<source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
<source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm; codecs="vp8, vorbis"' />
<source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg; codecs="theora, vorbis"' />
<!-- Flash Fallback. Use any flash video player here. Make sure to keep the vjs-flash-fallback class. -->
<object id="flash_fallback_1" class="vjs-flash-fallback" width="640" height="264" type="application/x-shockwave-flash"
data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf">
<param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" />
<param name="wmode" value="opaque" />
<param name="allowfullscreen" value="true" />
<param name="flashvars" value='config={"playlist":["http://video-js.zencoder.com/oceans-clip.png", {"url": "http://video-js.zencoder.com/oceans-clip.mp4","autoPlay":false,"autoBuffering":true}]}' />
<!-- Image Fallback. Typically the same as the poster image. -->
<img src="http://video-js.zencoder.com/oceans-clip.png" width="640" height="264" alt="Poster Image"
title="No video playback capabilities." />
</object>
</video>
<!-- Download links provided for devices that can't play video in the browser. -->
<p class="vjs-no-video"><strong>Download Video:</strong>
<a href="http://video-js.zencoder.com/oceans-clip.mp4">MP4</a>,
<a href="http://video-js.zencoder.com/oceans-clip.webm">WebM</a>,
<a href="http://video-js.zencoder.com/oceans-clip.ogv">Ogg</a><br>
<!-- Support VideoJS by keeping this link. -->
<a href="http://videojs.com">HTML5 Video Player</a> by VideoJS
</p>
</div>
<!-- End VideoJS -->
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>
+13
Ver Arquivo
@@ -0,0 +1,13 @@
var vjsSourceList = [];
vjsSourceList.push('_begin.js')
vjsSourceList.push('_end.js')
vjsSourceList.push('component.js')
vjsSourceList.push('controls.js')
vjsSourceList.push('core.js')
vjsSourceList.push('ecma.js')
vjsSourceList.push('events.js')
vjsSourceList.push('json.js')
vjsSourceList.push('lib.js')
vjsSourceList.push('player.js')
vjsSourceList.push('tech.js')
vjsSourceList.push('tracks.js')
-161
Ver Arquivo
@@ -1,161 +0,0 @@
/* Player API
================================================================================ */
VideoJS.fn.extend({
/* Listener types: play, pause, timeupdate, bufferedupdate, ended, volumechange, error */
addEventListener: function(type, fn){
if (!this.listeners[type]) { this.listeners[type] = []; }
this.listeners[type].push(fn);
},
// Alias for backwards compatibility
addListener: function(){ return this.addEventListener.apply(this, arguments); },
triggerListeners: function(type, e){
this.each(this.listeners[type], function(listener){
listener.call(this, e);
});
},
removeListener: function(type, fn){
var listeners = this.listeners[type];
if (!listeners) { return; }
for (var i=0; i<listeners.length; i++) {
if (listeners[i] == fn) {
listeners.splice(i--, 1);
}
}
},
play: function(){ this.api.play.apply(this); return this; },
pause: function(){ this.api.pause.apply(this); return this; },
paused: function(){ return this.api.paused.apply(this); },
currentTime: function(seconds){
if (seconds !== undefined) {
this.values.currentTime = seconds; // Cache the last set value for smoother scrubbing.
this.api.setCurrentTime.call(this, seconds);
return this;
}
return this.api.currentTime.apply(this);
},
duration: function(){ return this.api.duration.apply(this); },
buffered: function(){
var buffered = this.api.buffered.apply(this),
start = 0, end = this.values.bufferEnd = this.values.bufferEnd || 0,
timeRange;
if (buffered && buffered.length > 0 && buffered.end(0) > end) {
end = buffered.end(0);
// Storing values allows them be overridden by setBufferedFromProgress
this.values.bufferEnd = end;
}
return this.createTimeRange(start, end);
},
// Mimic HTML5 TimeRange Spec.
createTimeRange: function(start, end){
return {
length: 1,
start: function() { return start; },
end: function() { return end; }
};
},
// Calculates amount of buffer is full
bufferedPercent: function(){ return (this.duration()) ? this.buffered().end(0) / this.duration() : 0; },
volume: function(percentAsDecimal){
if (percentAsDecimal !== undefined) {
var vol = Math.max(0, Math.min(1, parseFloat(percentAsDecimal))); // Force value to between 0 and 1
this.values.volume = vol;
this.api.setVolume.call(this, vol);
this.setLocalStorage("volume", vol);
return this;
}
// if (this.values.volume) { return this.values.volume; }
return this.api.volume.call(this);
},
width: function(width, skipListeners){
if (width !== undefined) {
this.element.width = width; // Not using style so it can be overridden on fullscreen.
this.box.style.width = width+"px";
if (!skipListeners) { this.triggerListeners("resize"); }
return this;
}
return parseInt(this.element.getAttribute("width"));
// return this.element.offsetWidth;
},
height: function(height){
if (height !== undefined) {
this.element.height = height;
this.box.style.height = height+"px";
this.triggerListeners("resize");
return this;
}
return parseInt(this.element.getAttribute("height"));
// return this.element.offsetHeight;
},
size: function(width, height){
// Skip resize listeners on width for optimization
return this.width(width, true).height(height);
},
supportsFullScreen: function(){ return this.api.supportsFullScreen.call(this); },
// Turn on fullscreen (or window) mode
enterFullScreen: function(){
if (this.supportsFullScreen()) {
this.api.enterFullScreen.call(this);
} else {
this.enterFullWindow();
}
this.triggerListeners("enterFullScreen");
return this;
},
exitFullScreen: function(){
if (!this.supportsFullScreen()) {
this.exitFullWindow();
}
this.triggerListeners("exitFullScreen");
// Otherwise Shouldn't be called since native fullscreen uses own controls.
return this;
},
enterFullWindow: function(){
this.videoIsFullScreen = true;
// Storing original doc overflow value to return to when fullscreen is off
this.docOrigOverflow = document.documentElement.style.overflow;
// Add listener for esc key to exit fullscreen
_V_.addListener(document, "keydown", this.fullscreenOnEscKey.rEvtContext(this));
// Add listener for a window resize
_V_.addListener(window, "resize", this.fullscreenOnWindowResize.rEvtContext(this));
// Hide any scroll bars
document.documentElement.style.overflow = 'hidden';
// Apply fullscreen styles
_V_.addClass(this.box, "vjs-fullscreen");
// Resize the box, controller, and poster
this.positionAll();
this.triggerListeners("enterFullWindow");
},
exitFullWindow: function(){
this.videoIsFullScreen = false;
document.removeEventListener("keydown", this.fullscreenOnEscKey, false);
window.removeEventListener("resize", this.fullscreenOnWindowResize, false);
// Unhide scroll bars.
document.documentElement.style.overflow = this.docOrigOverflow;
// Remove fullscreen styles
_V_.removeClass(this.box, "vjs-fullscreen");
// Resize the box, controller, and poster to original sizes
this.positionAll();
this.triggerListeners("exitFullWindow");
},
src: function(src){
this.api.src.call(this, src);
return this;
}
});
-579
Ver Arquivo
@@ -1,579 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
// Element Behaviors
// Tell elements how to act or react
////////////////////////////////////////////////////////////////////////////////
/* Player Behaviors - How VideoJS reacts to what the video is doing.
================================================================================ */
VideoJS.fn.newBehavior("player", function(player){
this.addListener("error", this.playerOnVideoError);
this.addListener("play", this.playerOnVideoPlay);
this.addListener("play", this.trackCurrentTime);
this.addListener("pause", this.stopTrackingCurrentTime);
this.addListener("ended", this.playerOnVideoEnded);
this.trackBuffered();
this.addListener("bufferedupdate", this.bufferFull);
},{
playerOnVideoError: function(event){
this.log(event);
this.log(this.video.error);
},
playerOnVideoPlay: function(event){ this.hasPlayed = true; },
playerOnVideoEnded: function(event){
if (this.options.loop) {
this.currentTime(0);
this.play();
} else if (this.options.returnToStart) {
this.currentTime(0);
this.pause();
}
},
/* Load Tracking -------------------------------------------------------------- */
// Buffer watching method for load progress.
// Used for browsers that don't support the progress event
trackBuffered: function(){
this.bufferedInterval = setInterval(function(){
// Don't trigger unless
if (this.values.bufferEnd < this.buffered().end(0)) {
this.triggerListeners("bufferedupdate");
}
}.context(this), 500);
},
stopTrackingBuffered: function(){ clearInterval(this.bufferedInterval); },
bufferFull: function(){
if (this.bufferedPercent() == 1) {
this.stopTrackingBuffered();
}
},
/* Time Tracking -------------------------------------------------------------- */
trackCurrentTime: function(){
if (this.currentTimeInterval) { clearInterval(this.currentTimeInterval); }
this.currentTimeInterval = setInterval(function(){
this.triggerListeners("timeupdate");
}.context(this), 100); // 42 = 24 fps
this.trackingCurrentTime = true;
},
// Turn off play progress tracking (when paused or dragging)
stopTrackingCurrentTime: function(){
clearInterval(this.currentTimeInterval);
this.trackingCurrentTime = false;
}
}
);
/* Mouse Over Video Reporter Behaviors - i.e. Controls hiding based on mouse location
================================================================================ */
VideoJS.fn.newBehavior("mouseOverVideoReporter", function(element){
// Listen for the mouse move the video. Used to reveal the controller.
_V_.addListener(element, "mousemove", this.mouseOverVideoReporterOnMouseMove.context(this));
// Listen for the mouse moving out of the video. Used to hide the controller.
_V_.addListener(element, "mouseout", this.mouseOverVideoReporterOnMouseOut.context(this));
},{
mouseOverVideoReporterOnMouseMove: function(){
this.showControlBars();
clearInterval(this.mouseMoveTimeout);
this.mouseMoveTimeout = setTimeout(this.hideControlBars.context(this), 4000);
},
mouseOverVideoReporterOnMouseOut: function(event){
// Prevent flicker by making sure mouse hasn't left the video
var parent = event.relatedTarget;
while (parent && parent !== this.box) {
parent = parent.parentNode;
}
if (parent !== this.box) {
this.hideControlBars();
}
}
}
);
/* Mouse Over Video Reporter Behaviors - i.e. Controls hiding based on mouse location
================================================================================ */
VideoJS.fn.newBehavior("box", function(element){
this.positionBox();
_V_.addClass(element, "vjs-paused");
this.activateElement(element, "mouseOverVideoReporter");
this.addListener("play", this.boxOnVideoPlay);
this.addListener("pause", this.boxOnVideoPause);
},{
boxOnVideoPlay: function(){
_V_.removeClass(this.box, "vjs-paused");
_V_.addClass(this.box, "vjs-playing");
},
boxOnVideoPause: function(){
_V_.removeClass(this.box, "vjs-playing");
_V_.addClass(this.box, "vjs-paused");
}
}
);
/* Poster Image Overlay
================================================================================ */
VideoJS.fn.newBehavior("poster", function(element){
this.activateElement(element, "mouseOverVideoReporter");
this.activateElement(element, "playButton");
this.addListener("play", this.hidePoster);
this.addListener("ended", this.showPoster);
this.addListener("resize", this.positionPoster);
},{
showPoster: function(){
if (!this.poster) { return; }
this.poster.style.display = "block";
this.positionPoster();
},
positionPoster: function(){
// Only if the poster is visible
if (!this.poster || this.poster.style.display == 'none') { return; }
this.poster.style.height = this.height() + "px"; // Need incase controlsBelow
this.poster.style.width = this.width() + "px"; // Could probably do 100% of box
},
hidePoster: function(){
if (!this.poster) { return; }
this.poster.style.display = "none";
},
// Update poster source from attribute or fallback image
// iPad breaks if you include a poster attribute, so this fixes that
updatePosterSource: function(){
if (!this.video.poster) {
var images = this.video.getElementsByTagName("img");
if (images.length > 0) { this.video.poster = images[0].src; }
}
}
}
);
/* Control Bar Behaviors
================================================================================ */
VideoJS.fn.newBehavior("controlBar", function(element){
if (!this.controlBars) {
this.controlBars = [];
this.addListener("resize", this.positionControlBars);
}
this.controlBars.push(element);
_V_.addListener(element, "mousemove", this.onControlBarsMouseMove.context(this));
_V_.addListener(element, "mouseout", this.onControlBarsMouseOut.context(this));
},{
showControlBars: function(){
if (!this.options.controlsEnabled) { return; }
if (!this.options.controlsAtStart && !this.hasPlayed) { return; }
this.each(this.controlBars, function(bar){
// bar.style.opacity = 1;
bar.style.display = "block";
});
},
// Place controller relative to the video's position (now just resizing bars)
positionControlBars: function(){
this.updatePlayProgressBars();
this.updateLoadProgressBars();
},
hideControlBars: function(){
if (this.options.controlsHiding && !this.mouseIsOverControls) {
this.each(this.controlBars, function(bar){
// bar.style.opacity = 0;
bar.style.display = "none";
});
}
},
// Block controls from hiding when mouse is over them.
onControlBarsMouseMove: function(){ this.mouseIsOverControls = true; },
onControlBarsMouseOut: function(event){
this.mouseIsOverControls = false;
}
}
);
/* PlayToggle, PlayButton, PauseButton Behaviors
================================================================================ */
// Play Toggle
VideoJS.fn.newBehavior("playToggle", function(element){
if (!this.elements.playToggles) {
this.elements.playToggles = [];
this.addListener("play", this.playTogglesOnPlay);
this.addListener("pause", this.playTogglesOnPause);
}
this.elements.playToggles.push(element);
_V_.addListener(element, "click", this.onPlayToggleClick.context(this));
},{
onPlayToggleClick: function(event){
if (this.paused()) {
this.play();
} else {
this.pause();
}
},
playTogglesOnPlay: function(event){
this.each(this.elements.playToggles, function(toggle){
_V_.removeClass(toggle, "vjs-paused");
_V_.addClass(toggle, "vjs-playing");
});
},
playTogglesOnPause: function(event){
this.each(this.elements.playToggles, function(toggle){
_V_.removeClass(toggle, "vjs-playing");
_V_.addClass(toggle, "vjs-paused");
});
}
}
);
// Play
VideoJS.fn.newBehavior("playButton", function(element){
_V_.addListener(element, "click", this.onPlayButtonClick.context(this));
},{
onPlayButtonClick: function(event){ this.play(); }
}
);
// Pause
VideoJS.fn.newBehavior("pauseButton", function(element){
_V_.addListener(element, "click", this.onPauseButtonClick.context(this));
},{
onPauseButtonClick: function(event){ this.pause(); }
}
);
/* Play Progress Bar Behaviors
================================================================================ */
VideoJS.fn.newBehavior("playProgressBar", function(element){
if (!this.elements.playProgressBars) {
this.elements.playProgressBars = [];
this.addListener("timeupdate", this.updatePlayProgressBars);
}
this.elements.playProgressBars.push(element);
},{
// Ajust the play progress bar's width based on the current play time
updatePlayProgressBars: function(newTime){
var progress = (this.scrubbing) ? this.values.currentTime / this.duration() : this.currentTime() / this.duration();
if (isNaN(progress)) { progress = 0; }
this.each(this.elements.playProgressBars, function(bar){
if (bar.style) { bar.style.width = _V_.round(progress * 100, 2) + "%"; }
});
}
}
);
/* Load Progress Bar Behaviors
================================================================================ */
VideoJS.fn.newBehavior("loadProgressBar", function(element){
if (!this.elements.loadProgressBars) { this.elements.loadProgressBars = []; }
this.elements.loadProgressBars.push(element);
this.addListener("bufferedupdate", this.updateLoadProgressBars);
},{
updateLoadProgressBars: function(){
this.each(this.elements.loadProgressBars, function(bar){
if (bar.style) { bar.style.width = _V_.round(this.bufferedPercent() * 100, 2) + "%"; }
});
}
}
);
/* Current Time Display Behaviors
================================================================================ */
VideoJS.fn.newBehavior("currentTimeDisplay", function(element){
if (!this.elements.currentTimeDisplays) {
this.elements.currentTimeDisplays = [];
this.addListener("timeupdate", this.updateCurrentTimeDisplays);
}
this.elements.currentTimeDisplays.push(element);
},{
// Update the displayed time (00:00)
updateCurrentTimeDisplays: function(newTime){
// Allows for smooth scrubbing, when player can't keep up.
var time = (this.scrubbing) ? this.values.currentTime : this.currentTime();
this.each(this.elements.currentTimeDisplays, function(dis){
dis.innerHTML = _V_.formatTime(time);
});
}
}
);
/* Duration Display Behaviors
================================================================================ */
VideoJS.fn.newBehavior("durationDisplay", function(element){
if (!this.elements.durationDisplays) {
this.elements.durationDisplays = [];
this.addListener("timeupdate", this.updateDurationDisplays);
}
this.elements.durationDisplays.push(element);
},{
updateDurationDisplays: function(){
this.each(this.elements.durationDisplays, function(dis){
if (this.duration()) { dis.innerHTML = _V_.formatTime(this.duration()); }
});
}
}
);
/* Current Time Scrubber Behaviors
================================================================================ */
VideoJS.fn.newBehavior("currentTimeScrubber", function(element){
_V_.addListener(element, "mousedown", this.onCurrentTimeScrubberMouseDown.rEvtContext(this));
},{
// Adjust the play position when the user drags on the progress bar
onCurrentTimeScrubberMouseDown: function(event, scrubber){
event.preventDefault();
this.currentScrubber = scrubber;
this.stopTrackingCurrentTime(); // Allows for smooth scrubbing
this.scrubbing = true;
this.videoWasPlaying = !this.paused();
this.pause();
_V_.blockTextSelection();
this.setCurrentTimeWithScrubber(event);
_V_.addListener(document, "mousemove", this.onCurrentTimeScrubberMouseMove.rEvtContext(this));
_V_.addListener(document, "mouseup", this.onCurrentTimeScrubberMouseUp.rEvtContext(this));
},
onCurrentTimeScrubberMouseMove: function(event){ // Removeable
this.setCurrentTimeWithScrubber(event);
},
onCurrentTimeScrubberMouseUp: function(event){ // Removeable
_V_.unblockTextSelection();
document.removeEventListener("mousemove", this.onCurrentTimeScrubberMouseMove, false);
document.removeEventListener("mouseup", this.onCurrentTimeScrubberMouseUp, false);
this.scrubbing = false;
if (this.videoWasPlaying) {
this.play();
this.trackCurrentTime();
}
},
setCurrentTimeWithScrubber: function(event){
var newProgress = _V_.getRelativePosition(event.pageX, this.currentScrubber);
var newTime = newProgress * this.duration();
// Don't let video end while scrubbing.
if (newTime == this.duration()) { newTime = newTime - 0.1; }
this.currentTime(newTime);
this.triggerListeners("timeupdate");
}
}
);
/* Volume Display Behaviors
================================================================================ */
VideoJS.fn.newBehavior("volumeDisplay", function(element){
if (!this.elements.volumeDisplays) {
this.elements.volumeDisplays = [];
this.addListener("volumechange", this.updateVolumeDisplays);
}
this.elements.volumeDisplays.push(element);
this.updateVolumeDisplay(element); // Set the display to the initial volume
},{
// Update the volume control display
// Unique to these default controls. Uses borders to create the look of bars.
updateVolumeDisplays: function(){
if (!this.elements.volumeDisplays) { return; }
this.each(this.elements.volumeDisplays, function(dis){
this.updateVolumeDisplay(dis);
});
},
updateVolumeDisplay: function(display){
var volNum = Math.ceil(this.volume() * 6);
this.each(display.children, function(child, num){
if (num < volNum) {
_V_.addClass(child, "vjs-volume-level-on");
} else {
_V_.removeClass(child, "vjs-volume-level-on");
}
});
}
}
);
/* Volume Scrubber Behaviors
================================================================================ */
VideoJS.fn.newBehavior("volumeScrubber", function(element){
_V_.addListener(element, "mousedown", this.onVolumeScrubberMouseDown.rEvtContext(this));
},{
// Adjust the volume when the user drags on the volume control
onVolumeScrubberMouseDown: function(event, scrubber){
// event.preventDefault();
_V_.blockTextSelection();
this.currentScrubber = scrubber;
this.setVolumeWithScrubber(event);
_V_.addListener(document, "mousemove", this.onVolumeScrubberMouseMove.rEvtContext(this));
_V_.addListener(document, "mouseup", this.onVolumeScrubberMouseUp.rEvtContext(this));
},
onVolumeScrubberMouseMove: function(event){
this.setVolumeWithScrubber(event);
},
onVolumeScrubberMouseUp: function(event){
this.setVolumeWithScrubber(event);
_V_.unblockTextSelection();
document.removeEventListener("mousemove", this.onVolumeScrubberMouseMove, false);
document.removeEventListener("mouseup", this.onVolumeScrubberMouseUp, false);
},
setVolumeWithScrubber: function(event){
var newVol = _V_.getRelativePosition(event.pageX, this.currentScrubber);
this.volume(newVol);
}
}
);
/* Fullscreen Toggle Behaviors
================================================================================ */
VideoJS.fn.newBehavior("fullscreenToggle", function(element){
_V_.addListener(element, "click", this.onFullscreenToggleClick.context(this));
},{
// When the user clicks on the fullscreen button, update fullscreen setting
onFullscreenToggleClick: function(event){
if (!this.videoIsFullScreen) {
this.enterFullScreen();
} else {
this.exitFullScreen();
}
},
fullscreenOnWindowResize: function(event){ // Removeable
this.positionControlBars();
},
// Create listener for esc key while in full screen mode
fullscreenOnEscKey: function(event){ // Removeable
if (event.keyCode == 27) {
this.exitFullScreen();
}
}
}
);
/* Big Play Button Behaviors
================================================================================ */
VideoJS.fn.newBehavior("bigPlayButton", function(element){
if (!this.elements.bigPlayButtons) {
this.elements.bigPlayButtons = [];
this.addListener("play", this.hideBigPlayButtons);
this.addListener("ended", this.showBigPlayButtons);
}
this.elements.bigPlayButtons.push(element);
this.activateElement(element, "playButton");
},{
showBigPlayButtons: function(){
if (!this.options.controlsEnabled) { return; }
this.each(this.elements.bigPlayButtons, function(element){
element.style.display = "block";
});
},
hideBigPlayButtons: function(){
this.each(this.elements.bigPlayButtons, function(element){
element.style.display = "none";
});
}
}
);
/* Spinner
================================================================================ */
VideoJS.fn.newBehavior("spinner", function(element){
if (!this.spinners) {
this.spinners = [];
this.spinnersRotated = 0;
_V_.addListener(this.video, "loadeddata", this.spinnersOnVideoLoadedData.context(this));
_V_.addListener(this.video, "loadstart", this.spinnersOnVideoLoadStart.context(this));
_V_.addListener(this.video, "seeking", this.spinnersOnVideoSeeking.context(this));
_V_.addListener(this.video, "seeked", this.spinnersOnVideoSeeked.context(this));
_V_.addListener(this.video, "canplay", this.spinnersOnVideoCanPlay.context(this));
_V_.addListener(this.video, "canplaythrough", this.spinnersOnVideoCanPlayThrough.context(this));
_V_.addListener(this.video, "waiting", this.spinnersOnVideoWaiting.context(this));
_V_.addListener(this.video, "stalled", this.spinnersOnVideoStalled.context(this));
_V_.addListener(this.video, "suspend", this.spinnersOnVideoSuspend.context(this));
_V_.addListener(this.video, "playing", this.spinnersOnVideoPlaying.context(this));
_V_.addListener(this.video, "timeupdate", this.spinnersOnVideoTimeUpdate.context(this));
}
this.spinners.push(element);
},{
showSpinners: function(){
this.each(this.spinners, function(spinner){
spinner.style.display = "block";
});
clearInterval(this.spinnerInterval);
this.spinnerInterval = setInterval(this.rotateSpinners.context(this), 100);
},
hideSpinners: function(){
this.each(this.spinners, function(spinner){
spinner.style.display = "none";
});
clearInterval(this.spinnerInterval);
},
rotateSpinners: function(){
this.each(this.spinners, function(spinner){
// spinner.style.transform = 'scale(0.5) rotate('+this.spinnersRotated+'deg)';
spinner.style.WebkitTransform = 'scale(0.5) rotate('+this.spinnersRotated+'deg)';
spinner.style.MozTransform = 'scale(0.5) rotate('+this.spinnersRotated+'deg)';
});
if (this.spinnersRotated == 360) { this.spinnersRotated = 0; }
this.spinnersRotated += 45;
},
spinnersOnVideoLoadedData: function(event){ this.hideSpinners(); },
spinnersOnVideoLoadStart: function(event){ this.showSpinners(); },
spinnersOnVideoSeeking: function(event){ /* this.showSpinners(); */ },
spinnersOnVideoSeeked: function(event){ /* this.hideSpinners(); */ },
spinnersOnVideoCanPlay: function(event){ /* this.hideSpinners(); */ },
spinnersOnVideoCanPlayThrough: function(event){ this.hideSpinners(); },
spinnersOnVideoWaiting: function(event){
// Safari sometimes triggers waiting inappropriately
// Like after video has played, and you play again.
this.showSpinners();
},
spinnersOnVideoStalled: function(event){},
spinnersOnVideoSuspend: function(event){},
spinnersOnVideoPlaying: function(event){ this.hideSpinners(); },
spinnersOnVideoTimeUpdate: function(event){
// Safari sometimes calls waiting and doesn't recover
if(this.spinner.style.display == "block") { this.hideSpinners(); }
}
}
);
/* Subtitles
================================================================================ */
VideoJS.fn.newBehavior("subtitlesDisplay", function(element){
if (!this.elements.subtitleDisplays) {
this.elements.subtitleDisplays = [];
this.addListener("timeupdate", this.subtitleDisplaysOnVideoTimeUpdate);
this.addListener("ended", function() { this.lastSubtitleIndex = 0; }.context(this));
}
this.elements.subtitleDisplays.push(element);
},{
subtitleDisplaysOnVideoTimeUpdate: function(){
// Assuming all subtitles are in order by time, and do not overlap
if (this.subtitles) {
var time = this.currentTime();
// If current subtitle should stay showing, don't do anything. Otherwise, find new subtitle.
if (!this.currentSubtitle || this.currentSubtitle.start >= time || this.currentSubtitle.end < time) {
var newSubIndex = false,
// Loop in reverse if lastSubtitle is after current time (optimization)
// Meaning the user is scrubbing in reverse or rewinding
reverse = (this.subtitles[this.lastSubtitleIndex].start > time),
// If reverse, step back 1 becase we know it's not the lastSubtitle
i = this.lastSubtitleIndex - (reverse) ? 1 : 0;
while (true) { // Loop until broken
if (reverse) { // Looping in reverse
// Stop if no more, or this subtitle ends before the current time (no earlier subtitles should apply)
if (i < 0 || this.subtitles[i].end < time) { break; }
// End is greater than time, so if start is less, show this subtitle
if (this.subtitles[i].start < time) {
newSubIndex = i;
break;
}
i--;
} else { // Looping forward
// Stop if no more, or this subtitle starts after time (no later subtitles should apply)
if (i >= this.subtitles.length || this.subtitles[i].start > time) { break; }
// Start is less than time, so if end is later, show this subtitle
if (this.subtitles[i].end > time) {
newSubIndex = i;
break;
}
i++;
}
}
// Set or clear current subtitle
if (newSubIndex !== false) {
this.currentSubtitle = this.subtitles[newSubIndex];
this.lastSubtitleIndex = newSubIndex;
this.updateSubtitleDisplays(this.currentSubtitle.text);
} else if (this.currentSubtitle) {
this.currentSubtitle = false;
this.updateSubtitleDisplays("");
}
}
}
},
updateSubtitleDisplays: function(val){
this.each(this.elements.subtitleDisplays, function(disp){
disp.innerHTML = val;
});
}
}
);
-77
Ver Arquivo
@@ -1,77 +0,0 @@
/* Flash Player Type
================================================================================ */
VideoJS.fn.extend({
flashSupported: function(){
return !!this.flashPlayerVersionSupported();
},
flashInit: function(){
this.flashElement = this.getFlashElement();
this.replaceWithFlash();
this.element = this.flashElement;
this.video.src = ""; // Stop video from downloading if HTML5 is still supported
var flashPlayer = VideoJS.flashPlayers[this.options.flashPlayer];
this.api = flashPlayer.api;
flashPlayer.init.call(this);
this.api.setupTriggers.call(this);
},
// Get Flash Fallback object element from Embed Code
getFlashElement: function(){
var children = this.video.children;
for (var i=0,j=children.length; i<j; i++) {
if (children[i].className == "vjs-flash-fallback") {
return children[i];
}
}
},
buildFlashElement: function(){
this.flashElement = _V_.createElement("object", {
id: "flash_fallback_2",
className: "vjs-flash-fallback",
type: "application/x-shockwave-flash",
data: "http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf"
});
// <object width="640" height="264" >
var params = {
movie: 'http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf',
wmode: 'opaque',
allowfullscreen: 'true',
flashvars: 'config={"playlist":["http://video-js.zencoder.com/oceans-clip.png", {"url": "http://video-js.zencoder.com/oceans-clip.mp4","autoPlay":false,"autoBuffering":true}]}'
};
for (var name in params){
var p = _V_.createElement("param");
p.name = name;
p.value = params[name];
this.flashElement.appendChild(p);
}
},
// Used to force a browser to fall back when it's an HTML5 browser but there's no supported sources
replaceWithFlash: function(){
// this.flashElement = this.video.removeChild(this.flashElement);
if (this.flashElement) {
this.box.insertBefore(this.flashElement, this.video);
this.video.style.display = "none"; // Removing it was breaking later players
}
},
// Check if browser can use this flash player
flashPlayerVersionSupported: function(){
var playerVersion = (this.options.flashPlayerVersion) ? this.options.flashPlayerVersion : VideoJS.flashPlayers[this.options.flashPlayer].flashPlayerVersion;
return VideoJS.getFlashVersion() >= playerVersion;
}
});
/* Flash Object Fallback (Flash Player)
================================================================================ */
VideoJS.flashPlayers = {};
VideoJS.flashPlayers.htmlObject = {
flashPlayerVersion: 9,
init: function() { return true; },
api: {} // No video API available with HTML Object embed method
};
-474
Ver Arquivo
@@ -1,474 +0,0 @@
/* HTML5 Player Type
================================================================================ */
VideoJS.fn.extend({
html5Supported: function(){
if (VideoJS.browserSupportsVideo() && this.canPlaySource()) {
return true;
} else {
return false;
}
},
html5Init: function(){
this.element = this.video;
this.api = this.html5API;
this.api.setupTriggers.call(this);
this.fixPreloading(); // Support old browsers that used autobuffer
this.supportProgressEvents(); // Support browsers that don't use 'buffered'
// Set to stored volume OR 85%
this.volume((localStorage && localStorage.volume) || this.options.defaultVolume);
// Update interface for device needs
if (VideoJS.isIOS()) {
this.options.useBuiltInControls = true;
this.iOSInterface();
} else if (VideoJS.isAndroid()) {
this.options.useBuiltInControls = true;
this.androidInterface();
}
// Add VideoJS Controls
if (!this.options.useBuiltInControls) {
this.video.controls = false;
if (this.options.controlsBelow) { _V_.addClass(this.box, "vjs-controls-below"); }
// Make a click on th video act as a play button
this.activateElement(this.video, "playToggle");
// Build Interface
this.buildStylesCheckDiv(); // Used to check if style are loaded
this.buildAndActivatePoster();
this.buildBigPlayButton();
this.buildAndActivateSpinner();
this.buildAndActivateControlBar();
this.loadInterface(); // Show everything once styles are loaded
this.getSubtitles();
}
},
/* Source Managemet
================================================================================ */
canPlaySource: function(){
// Cache Result
if (this.canPlaySourceResult) { return this.canPlaySourceResult; }
// Loop through sources and check if any can play
var children = this.video.children;
for (var i=0,j=children.length; i<j; i++) {
if (children[i].tagName.toUpperCase() == "SOURCE") {
var canPlay = this.video.canPlayType(children[i].type) || this.canPlayExt(children[i].src);
if (canPlay == "probably" || canPlay == "maybe") {
this.firstPlayableSource = children[i];
this.canPlaySourceResult = true;
return true;
}
}
}
this.canPlaySourceResult = false;
return false;
},
// Check if the extention is compatible, for when type won't work
canPlayExt: function(src){
if (!src) { return ""; }
var match = src.match(/\.([^\.]+)$/);
if (match && match[1]) {
var ext = match[1].toLowerCase();
// Android canPlayType doesn't work
if (VideoJS.isAndroid()) {
if (ext == "mp4" || ext == "m4v") { return "maybe"; }
// Allow Apple HTTP Streaming for iOS
} else if (VideoJS.isIOS()) {
if (ext == "m3u8") { return "maybe"; }
}
}
return "";
},
// Force the video source - Helps fix loading bugs in a handful of devices, like the iPad/iPhone poster bug
// And iPad/iPhone javascript include location bug. And Android type attribute bug
forceTheSource: function(){
this.video.src = this.firstPlayableSource.src; // From canPlaySource()
this.video.load();
},
/* Device Fixes
================================================================================ */
// Support older browsers that used "autobuffer"
fixPreloading: function(){
if (typeof this.video.hasAttribute == "function" && this.video.hasAttribute("preload") && this.video.preload != "none") {
this.video.autobuffer = true; // Was a boolean
} else {
this.video.autobuffer = false;
this.video.preload = "none";
}
},
// Listen for Video Load Progress (currently does not if html file is local)
// Buffered does't work in all browsers, so watching progress as well
supportProgressEvents: function(e){
_V_.addListener(this.video, 'progress', this.setBufferedFromProgress.context(this));
},
// playerOnVideoProgress: function(event){
// this.setBufferedFromProgress(event);
// },
setBufferedFromProgress: function(event){ // HTML5 Only
if(event.total > 0 && this.duration()) {
var newBufferEnd = (event.loaded / event.total) * this.duration();
if (newBufferEnd > this.values.bufferEnd) {
this.values.bufferEnd = newBufferEnd;
this.triggerListeners("bufferedupdate");
}
}
},
iOSInterface: function(){
if(VideoJS.iOSVersion() < 4) { this.forceTheSource(); } // Fix loading issues
if(VideoJS.isIPad()) { // iPad could work with controlsBelow
this.buildAndActivateSpinner(); // Spinner still works well on iPad, since iPad doesn't have one
}
},
// Fix android specific quirks
// Use built-in controls, but add the big play button, since android doesn't have one.
androidInterface: function(){
this.forceTheSource(); // Fix loading issues
_V_.addListener(this.video, "click", function(){ this.play(); }); // Required to play
this.buildBigPlayButton(); // But don't activate the normal way. Pause doesn't work right on android.
_V_.addListener(this.bigPlayButton, "click", function(){ this.play(); }.context(this));
this.positionBox();
this.showBigPlayButtons();
},
/* Wait for styles (TODO: move to _V_)
================================================================================ */
loadInterface: function(){
if(!this.stylesHaveLoaded()) {
// Don't want to create an endless loop either.
if (!this.positionRetries) { this.positionRetries = 1; }
if (this.positionRetries++ < 100) {
setTimeout(this.loadInterface.context(this),10);
return;
}
}
this.hideStylesCheckDiv();
this.showPoster();
if (this.video.paused !== false) { this.showBigPlayButtons(); }
if (this.options.controlsAtStart) { this.showControlBars(); }
this.positionAll();
},
/* Control Bar
================================================================================ */
buildAndActivateControlBar: function(){
/* Creating this HTML
<div class="vjs-controls">
<div class="vjs-play-control">
<span></span>
</div>
<div class="vjs-progress-control">
<div class="vjs-progress-holder">
<div class="vjs-load-progress"></div>
<div class="vjs-play-progress"></div>
</div>
</div>
<div class="vjs-time-control">
<span class="vjs-current-time-display">00:00</span><span> / </span><span class="vjs-duration-display">00:00</span>
</div>
<div class="vjs-volume-control">
<div>
<span></span><span></span><span></span><span></span><span></span><span></span>
</div>
</div>
<div class="vjs-fullscreen-control">
<div>
<span></span><span></span><span></span><span></span>
</div>
</div>
</div>
*/
// Create a div to hold the different controls
this.controls = _V_.createElement("div", { className: "vjs-controls" });
// Add the controls to the video's container
this.box.appendChild(this.controls);
this.activateElement(this.controls, "controlBar");
this.activateElement(this.controls, "mouseOverVideoReporter");
// Build the play control
this.playControl = _V_.createElement("div", { className: "vjs-play-control", innerHTML: "<span></span>" });
this.controls.appendChild(this.playControl);
this.activateElement(this.playControl, "playToggle");
// Build the progress control
this.progressControl = _V_.createElement("div", { className: "vjs-progress-control" });
this.controls.appendChild(this.progressControl);
// Create a holder for the progress bars
this.progressHolder = _V_.createElement("div", { className: "vjs-progress-holder" });
this.progressControl.appendChild(this.progressHolder);
this.activateElement(this.progressHolder, "currentTimeScrubber");
// Create the loading progress display
this.loadProgressBar = _V_.createElement("div", { className: "vjs-load-progress" });
this.progressHolder.appendChild(this.loadProgressBar);
this.activateElement(this.loadProgressBar, "loadProgressBar");
// Create the playing progress display
this.playProgressBar = _V_.createElement("div", { className: "vjs-play-progress" });
this.progressHolder.appendChild(this.playProgressBar);
this.activateElement(this.playProgressBar, "playProgressBar");
// Create the progress time display (00:00 / 00:00)
this.timeControl = _V_.createElement("div", { className: "vjs-time-control" });
this.controls.appendChild(this.timeControl);
// Create the current play time display
this.currentTimeDisplay = _V_.createElement("span", { className: "vjs-current-time-display", innerHTML: "00:00" });
this.timeControl.appendChild(this.currentTimeDisplay);
this.activateElement(this.currentTimeDisplay, "currentTimeDisplay");
// Add time separator
this.timeSeparator = _V_.createElement("span", { innerHTML: " / " });
this.timeControl.appendChild(this.timeSeparator);
// Create the total duration display
this.durationDisplay = _V_.createElement("span", { className: "vjs-duration-display", innerHTML: "00:00" });
this.timeControl.appendChild(this.durationDisplay);
this.activateElement(this.durationDisplay, "durationDisplay");
// Create the volumne control
this.volumeControl = _V_.createElement("div", {
className: "vjs-volume-control",
innerHTML: "<div><span></span><span></span><span></span><span></span><span></span><span></span></div>"
});
this.controls.appendChild(this.volumeControl);
this.activateElement(this.volumeControl, "volumeScrubber");
this.volumeDisplay = this.volumeControl.children[0];
this.activateElement(this.volumeDisplay, "volumeDisplay");
// Crete the fullscreen control
this.fullscreenControl = _V_.createElement("div", {
className: "vjs-fullscreen-control",
innerHTML: "<div><span></span><span></span><span></span><span></span></div>"
});
this.controls.appendChild(this.fullscreenControl);
this.activateElement(this.fullscreenControl, "fullscreenToggle");
},
/* Poster Image
================================================================================ */
buildAndActivatePoster: function(){
this.updatePosterSource();
if (this.video.poster) {
this.poster = document.createElement("img");
// Add poster to video box
this.box.appendChild(this.poster);
// Add poster image data
this.poster.src = this.video.poster;
// Add poster styles
this.poster.className = "vjs-poster";
this.activateElement(this.poster, "poster");
} else {
this.poster = false;
}
},
/* Big Play Button
================================================================================ */
buildBigPlayButton: function(){
/* Creating this HTML
<div class="vjs-big-play-button"><span></span></div>
*/
this.bigPlayButton = _V_.createElement("div", {
className: "vjs-big-play-button",
innerHTML: "<span></span>"
});
this.box.appendChild(this.bigPlayButton);
this.activateElement(this.bigPlayButton, "bigPlayButton");
},
/* Spinner (Loading)
================================================================================ */
buildAndActivateSpinner: function(){
this.spinner = _V_.createElement("div", {
className: "vjs-spinner",
innerHTML: "<div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>"
});
this.box.appendChild(this.spinner);
this.activateElement(this.spinner, "spinner");
},
/* Styles Check - Check if styles are loaded (move ot _V_)
================================================================================ */
// Sometimes the CSS styles haven't been applied to the controls yet
// when we're trying to calculate the height and position them correctly.
// This causes a flicker where the controls are out of place.
buildStylesCheckDiv: function(){
this.stylesCheckDiv = _V_.createElement("div", { className: "vjs-styles-check" });
this.stylesCheckDiv.style.position = "absolute";
this.box.appendChild(this.stylesCheckDiv);
},
hideStylesCheckDiv: function(){ this.stylesCheckDiv.style.display = "none"; },
stylesHaveLoaded: function(){
if (this.stylesCheckDiv.offsetHeight != 5) {
return false;
} else {
return true;
}
},
/* VideoJS Box - Holds all elements
================================================================================ */
positionAll: function(){
this.positionBox();
this.positionControlBars();
this.positionPoster();
},
positionBox: function(){
// Set width based on fullscreen or not.
if (this.videoIsFullScreen) {
this.box.style.width = "";
this.element.style.height="";
if (this.options.controlsBelow) {
this.box.style.height = "";
this.element.style.height = (this.box.offsetHeight - this.controls.offsetHeight) + "px";
}
} else {
this.box.style.width = this.width() + "px";
this.element.style.height=this.height()+"px";
if (this.options.controlsBelow) {
this.element.style.height = "";
// this.box.style.height = this.video.offsetHeight + this.controls.offsetHeight + "px";
}
}
},
/* Subtitles
================================================================================ */
getSubtitles: function(){
var tracks = this.video.getElementsByTagName("TRACK");
for (var i=0,j=tracks.length; i<j; i++) {
if (tracks[i].getAttribute("kind") == "subtitles" && tracks[i].getAttribute("src")) {
this.subtitlesSource = tracks[i].getAttribute("src");
this.loadSubtitles();
this.buildSubtitles();
}
}
},
loadSubtitles: function() { _V_.get(this.subtitlesSource, this.parseSubtitles.context(this)); },
parseSubtitles: function(subText) {
var lines = subText.split("\n"),
line = "",
subtitle, time, text;
this.subtitles = [];
this.currentSubtitle = false;
this.lastSubtitleIndex = 0;
for (var i=0; i<lines.length; i++) {
line = _V_.trim(lines[i]); // Trim whitespace and linebreaks
if (line) { // Loop until a line with content
// First line - Number
subtitle = {
id: line, // Subtitle Number
index: this.subtitles.length // Position in Array
};
// Second line - Time
line = _V_.trim(lines[++i]);
time = line.split(" --> ");
subtitle.start = this.parseSubtitleTime(time[0]);
subtitle.end = this.parseSubtitleTime(time[1]);
// Additional lines - Subtitle Text
text = [];
for (var j=i; j<lines.length; j++) { // Loop until a blank line or end of lines
line = _V_.trim(lines[++i]);
if (!line) { break; }
text.push(line);
}
subtitle.text = text.join('<br/>');
// Add this subtitle
this.subtitles.push(subtitle);
}
}
},
parseSubtitleTime: function(timeText) {
var parts = timeText.split(':'),
time = 0;
// hours => seconds
time += parseFloat(parts[0])*60*60;
// minutes => seconds
time += parseFloat(parts[1])*60;
// get seconds
var seconds = parts[2].split(/\.|,/); // Either . or ,
time += parseFloat(seconds[0]);
// add miliseconds
ms = parseFloat(seconds[1]);
if (ms) { time += ms/1000; }
return time;
},
buildSubtitles: function(){
/* Creating this HTML
<div class="vjs-subtitles"></div>
*/
this.subtitlesDisplay = _V_.createElement("div", { className: 'vjs-subtitles' });
this.box.appendChild(this.subtitlesDisplay);
this.activateElement(this.subtitlesDisplay, "subtitlesDisplay");
},
/* Player API - Translate functionality from player to video
================================================================================ */
html5API: {
setupTriggers: function(){
// Make video events trigger player events
// May seem verbose here, but makes other APIs possible.
var types = ["play", "pause", "ended", "volumechange", "error"],
player = this, i, type;
for (i = 0; i<types.length; i++) {
type = types[i];
_V_.addListener(this.video, type, function(e){
player.triggerListeners(this, e);
}.context(type));
}
},
play: function(){ this.video.play(); },
pause: function(){ this.video.pause(); },
paused: function(){ return this.video.paused; },
currentTime: function(){ return this.video.currentTime; },
setCurrentTime: function(seconds){
try { this.video.currentTime = seconds; }
catch(e) { this.warning(VideoJS.warnings.videoNotReady); }
},
duration: function(){ return this.video.duration; },
buffered: function(){ return this.video.buffered; },
volume: function(){ return this.video.volume; },
setVolume: function(percentAsDecimal){ this.video.volume = percentAsDecimal; },
width: function(){ return this.video.offsetWidth; },
height: function(){ return this.video.offsetHeight; },
supportsFullScreen: function(){
if(typeof this.video.webkitEnterFullScreen == 'function') {
// Seems to be broken in Chromium/Chrome && Safari in Leopard
if (!navigator.userAgent.match("Chrome") && !navigator.userAgent.match("Mac OS X 10.5")) {
return true;
}
}
return false;
},
enterFullScreen: function(){
try {
this.video.webkitEnterFullScreen();
} catch (e) {
if (e.code == 11) { this.warning(VideoJS.warnings.videoNotReady); }
}
},
src: function(src){
this.video.src = src;
this.video.load();
}
}
});
-196
Ver Arquivo
@@ -1,196 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
// Convenience Functions (mini library)
// Functions not specific to video or VideoJS and could probably be replaced with a library like jQuery
////////////////////////////////////////////////////////////////////////////////
VideoJS.extend({
addClass: function(element, classToAdd){
if ((" "+element.className+" ").indexOf(" "+classToAdd+" ") == -1) {
element.className = element.className === "" ? classToAdd : element.className + " " + classToAdd;
}
},
removeClass: function(element, classToRemove){
if (element.className.indexOf(classToRemove) == -1) { return; }
var classNames = element.className.split(/\s+/);
classNames.splice(classNames.lastIndexOf(classToRemove),1);
element.className = classNames.join(" ");
},
createElement: function(tagName, attributes){
return this.merge(document.createElement(tagName), attributes);
},
// Attempt to block the ability to select text while dragging controls
blockTextSelection: function(){
document.body.focus();
document.onselectstart = function () { return false; };
},
// Turn off text selection blocking
unblockTextSelection: function(){ document.onselectstart = function () { return true; }; },
// Return seconds as MM:SS
formatTime: function(secs) {
var seconds = Math.round(secs);
var minutes = Math.floor(seconds / 60);
minutes = (minutes >= 10) ? minutes : "0" + minutes;
seconds = Math.floor(seconds % 60);
seconds = (seconds >= 10) ? seconds : "0" + seconds;
return minutes + ":" + seconds;
},
// Return the relative horizonal position of an event as a value from 0-1
getRelativePosition: function(x, relativeElement){
return Math.max(0, Math.min(1, (x - this.findPosX(relativeElement)) / relativeElement.offsetWidth));
},
// Get an objects position on the page
findPosX: function(obj) {
var curleft = obj.offsetLeft;
while(obj = obj.offsetParent) {
curleft += obj.offsetLeft;
}
return curleft;
},
getComputedStyleValue: function(element, style){
return window.getComputedStyle(element, null).getPropertyValue(style);
},
round: function(num, dec) {
if (!dec) { dec = 0; }
return Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
},
addListener: function(element, type, handler){
if (element.addEventListener) {
element.addEventListener(type, handler, false);
} else if (element.attachEvent) {
element.attachEvent("on"+type, handler);
}
},
removeListener: function(element, type, handler){
if (element.removeEventListener) {
element.removeEventListener(type, handler, false);
} else if (element.attachEvent) {
element.detachEvent("on"+type, handler);
}
},
get: function(url, onSuccess){
// if (netscape.security.PrivilegeManager.enablePrivilege) {
// netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
// }
if (typeof XMLHttpRequest == "undefined") {
XMLHttpRequest = function () {
try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch (e) {}
try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch (f) {}
try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (g) {}
//Microsoft.XMLHTTP points to Msxml2.XMLHTTP.3.0 and is redundant
throw new Error("This browser does not support XMLHttpRequest.");
};
}
var request = new XMLHttpRequest();
request.open("GET",url);
request.onreadystatechange = function() {
if (request.readyState == 4 && request.status == 200) {
onSuccess(request.responseText);
}
}.context(this);
try {
request.send();
} catch(e) {
// Can't access file.
}
},
trim: function(string){ return string.toString().replace(/^\s+/, "").replace(/\s+$/, ""); },
// DOM Ready functionality adapted from jQuery. http://jquery.com/
bindDOMReady: function(){
if (document.readyState === "complete") {
return VideoJS.onDOMReady();
}
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", VideoJS.DOMContentLoaded, false);
window.addEventListener("load", VideoJS.onDOMReady, false);
} else if (document.attachEvent) {
document.attachEvent("onreadystatechange", VideoJS.DOMContentLoaded);
window.attachEvent("onload", VideoJS.onDOMReady);
}
},
DOMContentLoaded: function(){
if (document.addEventListener) {
document.removeEventListener( "DOMContentLoaded", VideoJS.DOMContentLoaded, false);
VideoJS.onDOMReady();
} else if ( document.attachEvent ) {
if ( document.readyState === "complete" ) {
document.detachEvent("onreadystatechange", VideoJS.DOMContentLoaded);
VideoJS.onDOMReady();
}
}
},
// Functions to be run once the DOM is loaded
DOMReadyList: [],
addToDOMReady: function(fn){
if (VideoJS.DOMIsReady) {
fn.call(document);
} else {
VideoJS.DOMReadyList.push(fn);
}
},
DOMIsReady: false,
onDOMReady: function(){
if (VideoJS.DOMIsReady) { return; }
if (!document.body) { return setTimeout(VideoJS.onDOMReady, 13); }
VideoJS.DOMIsReady = true;
if (VideoJS.DOMReadyList) {
for (var i=0; i<VideoJS.DOMReadyList.length; i++) {
VideoJS.DOMReadyList[i].call(document);
}
VideoJS.DOMReadyList = null;
}
}
});
VideoJS.bindDOMReady();
// Allows for binding context to functions
// when using in event listeners and timeouts
Function.prototype.context = function(obj){
var method = this,
temp = function(){
return method.apply(obj, arguments);
};
return temp;
};
// Like context, in that it creates a closure
// But insteaad keep "this" intact, and passes the var as the second argument of the function
// Need for event listeners where you need to know what called the event
// Only use with event callbacks
Function.prototype.evtContext = function(obj){
var method = this,
temp = function(){
var origContext = this;
return method.call(obj, arguments[0], origContext);
};
return temp;
};
// Removeable Event listener with Context
// Replaces the original function with a version that has context
// So it can be removed using the original function name.
// In order to work, a version of the function must already exist in the player/prototype
Function.prototype.rEvtContext = function(obj, funcParent){
if (this.hasContext === true) { return this; }
if (!funcParent) { funcParent = obj; }
for (var attrname in funcParent) {
if (funcParent[attrname] == this) {
funcParent[attrname] = this.evtContext(obj);
funcParent[attrname].hasContext = true;
return funcParent[attrname];
}
}
return this.evtContext(obj);
};
-306
Ver Arquivo
@@ -1,306 +0,0 @@
// Using jresig's Class implementation http://ejohn.org/blog/simple-javascript-inheritance/
(function(){var initializing=false, fnTest=/xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/; this.JRClass = function(){}; JRClass.extend = function(prop) { var _super = this.prototype; initializing = true; var prototype = new this(); initializing = false; for (var name in prop) { prototype[name] = typeof prop[name] == "function" && typeof _super[name] == "function" && fnTest.test(prop[name]) ? (function(name, fn){ return function() { var tmp = this._super; this._super = _super[name]; var ret = fn.apply(this, arguments); this._super = tmp; return ret; }; })(name, prop[name]) : prop[name]; } function JRClass() { if ( !initializing && this.init ) this.init.apply(this, arguments); } JRClass.prototype = prototype; JRClass.constructor = JRClass; JRClass.extend = arguments.callee; return JRClass;};})();
// Video JS Player Class
var VideoJS = JRClass.extend({
// Initialize the player for the supplied video tag element
// element: video tag
init: function(element, setOptions){
// Allow an ID string or an element
if (typeof element == 'string') {
this.video = document.getElementById(element);
} else {
this.video = element;
}
this.video.player = this; // Store reference to player on the video element.
this.box = this.video.parentNode; // Container element for controls positioning
this.values = {}; // Cache for video property values.
this.elements = {}; // Store refs to controls elements.
this.listeners = {}; // Store video event listeners.
this.api = {}; // Current API to video functions (changes with player type)
// Hide Links. Will be shown again if "links" player is used
this.linksFallback = this.getLinksFallback();
this.hideLinksFallback();
// Default Options
this.options = {
autoplay: false,
preload: true,
loop: false,
returnToStart: true, // Go back to the beginning when the video is done
controlsEnabled: true,
useBuiltInControls: false, // Use the browser's controls (iPhone)
controlsBelow: false, // Display control bar below video vs. in front of
controlsAtStart: false, // Make controls visible when page loads
controlsHiding: true, // Hide controls when not over the video
defaultVolume: 0.85, // Will be overridden by localStorage volume if available
playerFallbackOrder: ["html5", "flash", "links"], // Players and order to use them
flashPlayer: "htmlObject", // htmlObject, or custom options available
flashPlayerVersion: false // Required flash version for fallback
};
// Override default options with global options
if (typeof VideoJS.options == "object") { _V_.merge(this.options, VideoJS.options); }
// Override default & global options with options specific to this player
if (typeof setOptions == "object") { _V_.merge(this.options, setOptions); }
// Override preload & autoplay with video attributes (test x = y || z on IE)
if (this.getPreloadAttribute() !== undefined) { this.options.preload = this.getPreloadAttribute(); }
if (this.getAutoplayAttribute() !== undefined) { this.options.autoplay = this.getAutoplayAttribute(); }
// Loop through the player names list in options, "html5" etc.
// For each player name, initialize the player with that name under VideoJS.players
// If the player successfully initializes, we're done
// If not, try the next player in the list
this.each(this.options.playerFallbackOrder, function(playerType){
if (this[playerType+"Supported"]()) { // Check if player type is supported
this[playerType+"Init"](); // Initialize player type
return true; // Stop looping through players
}
});
// Start Global Listeners - API doesn't exist before now
this.activateElement(this, "player");
this.activateElement(this.box, "box");
},
/* Behaviors - Make elements act like specific controls or displays
================================================================================ */
behaviors: {},
newBehavior: function(name, activate, functions){
this.behaviors[name] = activate;
this.extend(functions);
},
// Change to addBehavior or attachBehavior?
activateElement: function(element, behavior){
// Allow passing and ID string
if (typeof element == "string") { element = document.getElementById(element); }
this.behaviors[behavior].call(this, element);
},
/* Errors/Warnings
================================================================================ */
errors: [], // Array to track errors
warnings: [],
warning: function(warning){
this.warnings.push(warning);
this.log(warning);
},
/* History of errors/events (not quite there yet)
================================================================================ */
history: [],
log: function(event){
if (!event) { return; }
if (typeof event == "string") { event = { type: event }; }
if (event.type) { this.history.push(event.type); }
if (this.history.length >= 50) { this.history.shift(); }
try { console.log(event.type); } catch(e) { try { opera.postError(event.type); } catch(e){} }
},
/* Local Storage
================================================================================ */
setLocalStorage: function(key, value){
if (!localStorage) { return; }
try {
localStorage[key] = value;
} catch(e) {
if (e.code == 22 || e.code == 1014) { // Webkit == 22 / Firefox == 1014
this.warning(VideoJS.warnings.localStorageFull);
}
}
},
/* Helpers
================================================================================ */
getPreloadAttribute: function(){
if (typeof this.video.hasAttribute == "function" && this.video.hasAttribute("preload")) {
var preload = this.video.getAttribute("preload");
// Only included the attribute, thinking it was boolean
if (preload === "" || preload === "true") { return "auto"; }
if (preload === "false") { return "none"; }
return preload;
}
},
getAutoplayAttribute: function(){
if (typeof this.video.hasAttribute == "function" && this.video.hasAttribute("autoplay")) {
var autoplay = this.video.getAttribute("autoplay");
if (autoplay === "false") { return false; }
return true;
}
},
// Each that maintains player as context
// Break if true is returned
each: function(arr, fn){
if (!arr || arr.length === 0) { return; }
for (var i=0,j=arr.length; i<j; i++) {
if (fn.call(this, arr[i], i)) { break; }
}
},
// Add functions to the player
extend: function(obj){
for (var attrname in obj) {
if (obj.hasOwnProperty(attrname)) { this[attrname]=obj[attrname]; }
}
}
});
VideoJS.fn = VideoJS.prototype;
VideoJS.options = {}; // Globally set options
/* Download Links Fallback (Player Type)
================================================================================ */
VideoJS.fn.extend({
linksSupported: function(){ return true; },
linksInit: function(){
this.showLinksFallback();
this.element = this.video;
},
// Get the download links block element
getLinksFallback: function(){ return this.box.getElementsByTagName("P")[0]; },
// Hide no-video download paragraph
hideLinksFallback: function(){
if (this.linksFallback) { this.linksFallback.style.display = "none"; }
},
// Hide no-video download paragraph
showLinksFallback: function(){
if (this.linksFallback) { this.linksFallback.style.display = "block"; }
}
});
////////////////////////////////////////////////////////////////////////////////
// Class Methods
// Functions that don't apply to individual videos.
////////////////////////////////////////////////////////////////////////////////
// Combine Objects - Use "safe" to protect from overwriting existing items
VideoJS.merge = function(obj1, obj2, safe){
for (var attrname in obj2){
if (obj2.hasOwnProperty(attrname) && (!safe || !obj1.hasOwnProperty(attrname))) { obj1[attrname]=obj2[attrname]; }
}
return obj1;
};
VideoJS.extend = function(obj){ this.merge(this, obj, true); };
VideoJS.extend({
// Add VideoJS to all video tags with the video-js class when the DOM is ready
setupAll: function(options, fn){
// Options is stored globally, and added ot any new player on init
VideoJS.options = options;
VideoJS.DOMReady(VideoJS.setup);
if (fn) { VideoJS.DOMReady(fn); }
},
// Backward compatability. Changed to just SetupAll
setupAllWhenReady: function(options){ VideoJS.setupAll(options); },
// Run the supplied function when the DOM is ready
DOMReady: function(fn){
VideoJS.addToDOMReady(fn);
},
// Set up a specific video or array of video elements
// "video" can be:
// false, undefined, or "All": set up all videos with the video-js class
// A video tag ID or video tag element: set up one video and return one player
// An array of video tag elements/IDs: set up each and return an array of players
setup: function(videos, options){
var returnSingular = false,
playerList = [],
videoElement;
// If videos is undefined or "All", set up all videos with the video-js class
if (!videos || videos == "All") {
videos = VideoJS.getVideoJSTags();
// If videos is not an array, add to an array
} else if (typeof videos != 'object' || videos.nodeType == 1) {
videos = [videos];
returnSingular = true;
}
// Loop through videos and create players for them
for (var i=0; i<videos.length; i++) {
if (typeof videos[i] == 'string') {
videoElement = document.getElementById(videos[i]);
} else { // assume DOM object
videoElement = videos[i];
}
playerList.push(new VideoJS(videoElement, options));
}
// Return one or all depending on what was passed in
return (returnSingular) ? playerList[0] : playerList;
},
// Get the player object for the supplied video tag ID
player: function(id){ return document.getElementById(id).player; },
// Find video tags with the video-js class
getVideoJSTags: function() {
var videoTags = document.getElementsByTagName("video"),
videoJSTags = [], videoTag;
for (var i=0,j=videoTags.length; i<j; i++) {
videoTag = videoTags[i];
if (videoTag.className.indexOf("video-js") != -1) {
videoJSTags.push(videoTag);
}
}
return videoJSTags;
},
// Check if the browser supports video.
browserSupportsVideo: function() {
if (typeof VideoJS.videoSupport != "undefined") { return VideoJS.videoSupport; }
VideoJS.videoSupport = !!document.createElement('video').canPlayType;
return VideoJS.videoSupport;
},
getFlashVersion: function(){
// Cache Version
if (typeof VideoJS.flashVersion != "undefined") { return VideoJS.flashVersion; }
var version = 0, desc;
if (typeof navigator.plugins != "undefined" && typeof navigator.plugins["Shockwave Flash"] == "object") {
desc = navigator.plugins["Shockwave Flash"].description;
if (desc && !(typeof navigator.mimeTypes != "undefined" && navigator.mimeTypes["application/x-shockwave-flash"] && !navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin)) {
version = parseInt(desc.match(/^.*\s+([^\s]+)\.[^\s]+\s+[^\s]+$/)[1], 10);
}
} else if (typeof window.ActiveXObject != "undefined") {
try {
var testObject = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
if (testObject) {
version = parseInt(testObject.GetVariable("$version").match(/^[^\s]+\s(\d+)/)[1], 10);
}
}
catch(e) {}
}
VideoJS.flashVersion = version;
return VideoJS.flashVersion;
},
// Browser & Device Checks
isIE: function(){ return !+"\v1"; },
isIPad: function(){ return navigator.userAgent.match(/iPad/i) !== null; },
isIPhone: function(){ return navigator.userAgent.match(/iPhone/i) !== null; },
isIOS: function(){ return VideoJS.isIPhone() || VideoJS.isIPad(); },
iOSVersion: function() {
var match = navigator.userAgent.match(/OS (\d+)_/i);
if (match && match[1]) { return match[1]; }
},
isAndroid: function(){ return navigator.userAgent.match(/Android.*AppleWebKit/i) !== null; },
androidVersion: function() {
var match = navigator.userAgent.match(/Android (\d+)\./i);
if (match && match[1]) { return match[1]; }
},
//isAndroidBrowser
warnings: {
// Safari errors if you call functions on a video that hasn't loaded yet
videoNotReady: "Video is not ready yet (try playing the video first).",
// Getting a QUOTA_EXCEEDED_ERR when setting local storage occasionally
localStorageFull: "Local Storage is Full"
}
});
// Shim to make Video tag valid in IE
if(VideoJS.isIE()) { document.createElement("video"); }
// Expose to global
window.VideoJS = window._V_ = VideoJS;
-24
Ver Arquivo
@@ -1,24 +0,0 @@
/* jQuery Plugin
================================================================================ */
if (window.jQuery) {
(function($) {
$.fn.setupPlayer = function(options) {
return VideoJS.setup(this[0], options);
};
// Deprecated
$.fn.VideoJS = function(options) {
this.each(function() {
VideoJS.setup(this, options);
});
return this;
};
$.fn.player = function() {
return this[0].player;
};
})(jQuery);
}
-150
Ver Arquivo
@@ -1,150 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>HTML5 Video Player</title>
<!-- Include the VideoJS Library -->
<script src="src/main.js" type="text/javascript" charset="utf-8"></script>
<script src="src/api.js" type="text/javascript" charset="utf-8"></script>
<script src="src/html5.js" type="text/javascript" charset="utf-8"></script>
<script src="src/flash.js" type="text/javascript" charset="utf-8"></script>
<script src="src/behaviors.js" type="text/javascript" charset="utf-8"></script>
<script src="src/lib.js" type="text/javascript" charset="utf-8"></script>
<script src="src/video-js.jquery.js" type="text/javascript" charset="utf-8"></script>
<!-- <script src="flowplayer/video-js.flowplayer.js" type="text/javascript" charset="utf-8"></script> -->
<script type="text/javascript">
VideoJS.setupAllWhenReady({ playerFallbackOrder: ["flash", "links"] });
VideoJS.DOMReady(function(){
// myPlayer = VideoJS.setup("example_video_1", {
// // controlsHiding: true,
// // controlsBelow: false,
// // showControlsAtStart: true
// });
// myPlayer.activateElement(document.getElementById("scrub"), "playProgressBar");
// var vid = document.getElementById("example_video_1"),
// attrTable = document.getElementById("attributes"),
// attrNames = ["error", "networkState", "readyState", "preload", "buffered",
// "seeking", "currentTime", "initialTime", "duration", "startOffsetTime",
// "paused", "defaultPlaybackRate", "playbackRate", "played", "seekable",
// "ended", "autoplay", "loop", "controls", "volume", "muted", "tracks"
// ],
// attrs = {};
//
// for(var i=0,j=attrNames.length; i<j; i++) {
// var row = _V_.createElement("tr");
// var th = _V_.createElement("th");
// th.innerHTML = attrNames[i];
// attrs[attrNames[i]] = _V_.createElement("td", { id: attrNames[i] });
// row.appendChild(th); row.appendChild(attrs[attrNames[i]]);
// attrTable.appendChild(row);
// }
//
// setInterval(function(){
// for(var i=0,j=attrNames.length; i<j; i++) {
// attrs[attrNames[i]].innerHTML = vid[attrNames[i]];
// }
// }, 100);
//
// var events = ["loadstart","progress","suspend","abort","error","emptied","stalled","play","pause",
// "loadedmetadata", "loadeddata", "waiting", "playing", "canplay", "canplaythrough", "seeking", "seeked",
// // "timeupdate",
// "ended", "ratechange", "durationchange","volumechange"
// ],
// eventsList = document.getElementById("events");
//
// for(var i=0,j=events.length; i<j; i++) {
// _V_.addListener(vid, events[i], function(){
// eventsList.innerHTML = this + "\n" + eventsList.innerHTML
// }.context(events[i]));
// }
});
</script>
<style type="text/css" media="screen">
#attributes { width: 300px; float: left; }
#events { width: 300px; height: 500px; float: left; }
</style>
<!-- Include the VideoJS Stylesheet -->
<link rel="stylesheet" href="../video-js.css" type="text/css" media="screen" title="Video JS">
<link rel="stylesheet" href="../skins/tube.css" type="text/css" media="screen" title="Video JS">
<link rel="stylesheet" href="../skins/hu.css" type="text/css" media="screen" title="Video JS">
<link rel="stylesheet" href="../skins/vim.css" type="text/css" media="screen" title="Video JS">
</head>
<body>
<!-- Begin VideoJS -->
<div id="scrub" style="background: #000; height: 10px;"></div>
<div class="video-js-box">
<!-- Using the Video for Everybody Embed Code http://camendesign.com/code/video_for_everybody -->
<video id="example_video_1" class="video-js" width="640" height="264" controls="controls" preload="auto" poster="http://video-js.zencoder.com/oceans-clip.png">
<source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
<source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm; codecs="vp8, vorbis"' />
<source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg; codecs="theora, vorbis"' />
<track kind="subtitles" src="../demo-subtitles.srt" srclang="en-US" label="English"></track>
<!-- Flash Fallback. Use any flash video player here. Make sure to keep the vjs-flash-fallback class. -->
<object id="flash_fallback_1" class="vjs-flash-fallback" width="640" height="264" type="application/x-shockwave-flash"
data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf">
<param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" />
<param name="wmode" value="opaque" />
<param name="allowfullscreen" value="true" />
<param name="flashvars" value='config={"playlist":["http://video-js.zencoder.com/oceans-clip.png", {"url": "http://video-js.zencoder.com/oceans-clip.mp4","autoPlay":false,"autoBuffering":true}]}' />
<!-- Image Fallback. Typically the same as the poster image. -->
<img src="http://video-js.zencoder.com/oceans-clip.png" width="640" height="264" alt="Poster Image"
title="No video playback capabilities." />
</object>
</video>
<!-- Download links provided for devices that can't play video in the browser. -->
<p class="vjs-no-video"><strong>Download Video:</strong>
<a href="http://video-js.zencoder.com/oceans-clip.mp4">MP4</a>,
<a href="http://video-js.zencoder.com/oceans-clip.webm">WebM</a>,
<a href="http://video-js.zencoder.com/oceans-clip.ogv">Ogg</a><br>
<!-- Support VideoJS by keeping this link. -->
<a href="http://videojs.com">HTML5 Video Player</a> by VideoJS
</p>
</div>
<!-- End VideoJS -->
<div class="video-js-box">
<!-- Using the Video for Everybody Embed Code http://camendesign.com/code/video_for_everybody -->
<!-- <video id="example_video_2" class="video-jsnot" width="640" height="264" controls="controls" preload="none" poster="http://video-js.zencoder.com/oceans-clip.png"> -->
<source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
<source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm; codecs="vp8, vorbis"' />
<source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg; codecs="theora, vorbis"' />
<!-- Flash Fallback. Use any flash video player here. Make sure to keep the vjs-flash-fallback class. -->
<object id="flash_fallback_1" class="vjs-flash-fallback" width="640" height="264" type="application/x-shockwave-flash"
data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf">
<param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" />
<param name="wmode" value="opaque" />
<param name="allowfullscreen" value="true" />
<param name="flashvars" value='config={"playlist":["http://video-js.zencoder.com/oceans-clip.png", {"url": "http://video-js.zencoder.com/oceans-clip.mp4","autoPlay":false,"autoBuffering":true}]}' />
<!-- Image Fallback. Typically the same as the poster image. -->
<img src="http://video-js.zencoder.com/oceans-clip.png" width="640" height="264" alt="Poster Image"
title="No video playback capabilities." />
</object>
<!-- </video> -->
<!-- Download links provided for devices that can't play video in the browser. -->
<p class="vjs-no-video"><strong>Download Video:</strong>
<a href="http://video-js.zencoder.com/oceans-clip.mp4">MP4</a>,
<a href="http://video-js.zencoder.com/oceans-clip.webm">WebM</a>,
<a href="http://video-js.zencoder.com/oceans-clip.ogv">Ogg</a><br>
<!-- Support VideoJS by keeping this link. -->
<a href="http://videojs.com">HTML5 Video Player</a> by VideoJS
</p>
</div>
<!-- End VideoJS -->
<a href="#" onclick="document.getElementById('example_video_1').currentTime = 10; return false;">Click</a>
<table id="attributes">
</table>
<textarea id="events"></textarea>
</body>
</html>
-214
Ver Arquivo
@@ -1,214 +0,0 @@
API
===
The VideoJS API allows you to interact with the video through Javascript, whether the browser is playing the video through HTML5 video or through the Flash fallback (with supported Flash players).
To use the API functions, you need access to the video player object. Luckily this is easy to get. You just need to make sure your video tag has an ID. The default 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.
NOTE: Before you can access the player, the DOM must be ready and the VideoJS setup methods must have run. Follow the examples and you'll be fine.
Using the VideoJS setup with built-in DOM ready function.
VideoJS.setupAll(options, function(){
var myPlayer = VideoJS.player("example_video_id");
});
Using a javascript library's DOM ready function (jQuery example)
$(function(){ // DOM Ready
var myPlayer = VideoJS.setup("example_video_1", options);
});
After the player has been setup, you can also always access the player through the video element's "player" attribute.
// Javascript Example
myPlayer = document.getElementById("example_video_1").player;
// jQuery Example
myPlayer = $("#example_video_1")[0].player
// VideoJS jQuery Plugin Example
myPlayer = $("#example_video_1").player();
Now that you have access to the player through the myPlayer variable, you can control the video or react to video events using the following methods.
### play()
Start video playback.
Returns the player object.
Example:
myPlayer.play();
### onPlay(callback) // Type: Function
Trigger the supplied callback function every time the video starts playing.
Returns the player object.
Example:
myPlayer.onPlay(function(){
alert("OMG Video is playing!");
});
### pause()
Pause the video playback.
Returns: the player object
Example:
myPlayer.pause();
### onPause(callback) // Type: Function
Trigger the supplied callback function every time the video is paused.
Returns the player object.
Example:
myPlayer.onPause(function(){
alert("OMG Video is paused now!");
});
### currentTime()
Returns the current time of the video in seconds.
Example:
var whereYouAt = myPlayer.currentTime();
### currentTime(seconds) // Type: Integer or Float
Seek to the supplied time (seconds).
Returns the player object.
Example:
myPlayer.currentTime(120); // 2 minutes into the video
### onTimeUpdate(callback) // Type: Function
Trigger the supplied callback function every time the currentTime changes. This is triggered about 10 times per second.
Returns the player object.
Example:
myPlayer.onTimeUpdate(function(){
alert("The video is now " + myPlayer.currentTime() + " seconds in.");
});
### onEnded(callback) // Type: Function
Trigger the supplied callback function when the video finishes playing.
Returns the player object.
Example:
myPlayer.onEnded(function(){
alert("Fin!");
});
### duration()
Returns the length in time of the video in seconds. Note: The video must have started loading before the duration can be known.
Example:
var howLongIsThis = myPlayer.duration();
### onDurationUpdate(callback) // Type: Function
Trigger the supplied callback function when the video's duration is updated.
Returns the player object.
Example:
myPlayer.onDurationUpdate(function(){
alert("The video's duration is now " + myPlayer.duration());
});
### buffered()
Returns the amount of video that has loaded (downloaded) into the buffer.
Example:
// Needs to be expanded
var howMuchIsLoaded = myPlayer.duration();
### onBufferedUpdate(callback) // Type: Function
Trigger the supplied callback function when the video's buffered amount is updated.
Returns the player object.
Example:
// Needs to be updated
myPlayer.onBufferedUpdate(function(){
alert("The video's duration is now " + myPlayer.duration());
});
### volume()
Returns the current volume of the video as a percent in decimal form. 0 is off (muted), 1.0 is all the way up, 0.5 is half way.
Example:
var howLoudIsIt = myPlayer.volume();
### volume(percentAsDecimal)
Set the volume to the supplied percent (as a decimal between 0 and 1).
Example:
myPlayer.volume(0.5); // Set volume to half
### onVolumeChange(callback)
Trigger the supplied callback function when the video's volume changes.
Returns the player object.
Example:
myPlayer.onVolumeChange(function(){
alert("The video's volume is now " + myPlayer.volume());
});
### width()
Returns the current width of the video in pixels.
Example:
var howWideIsIt = myPlayer.width();
### width(pixels)
Change the width of the video to the supplied width in pixels.
Returns the player object
Example:
myPlayer.width(640);
### height()
Returns the current height of the video in pixels.
Example:
var howTallIsIt = myPlayer.height();
### height(pixels)
Change the height of the video to the supplied height in pixels.
Returns the player object
myPlayer.height(480);
### size(width, height)
Changes the width and height of the video to the supplied width and height. This is more efficient if you're changing both width and height.
Returns the player object.
myPlayer.size(640,480);
### onResize(callback)
Trigger the supplied callback function when the video's size (width, height, or both) changes.
Returns the player object.
myPlayer.onResize(function(){
alert("The video is now " + myPlayer.width() + " by " + myPlayer.height());
});
### enterFullScreen()
Increase the size of the video to full screen. In some browsers, full screen is not supported natively, so it enters full window mode, where the fills the browser window. In browsers that support native full screen, typically the browser's default controls will be shown, and not the VideoJS custom skin. In full window mode, the VideoJS controls and skin will always be used.
Returns the player object.
myPlayer.enterFullScreen();
### exitFullScreen()
Return the video to its normal size after having been in full screen mode.
Returns the player object.
myPlayer.exitFullScreen();
### onError(callback)
Trigger the supplied callback function when the video when there is an error with the video.
Returns the player object.
// Need to make work
myPlayer.onError(function(errorText, errorID){
alert("There's something wrong. " + errorText);
});
+242
Ver Arquivo
@@ -0,0 +1,242 @@
---
layout: docs
title: API
description: Video.JS API Docs - API settings based on the HTML5 video API
body_id: api
body_class: docs subpage
---
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.
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.
{% highlight javascript %}
var myPlayer = _V_("example_video_1");
{% endhighlight %}
(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.
{% highlight javascript %}
_V_("example_video_1").ready(function(){
var myPlayer = this;
// EXAMPLE: Start playing the video.
myPlayer.play();
});
{% endhighlight %}
API Methods
-----------
Now that you have access to a ready player, you can control the video 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);` )
### play()
Start video playback. Returns the player object.
{% highlight javascript %}
myPlayer.play();
{% endhighlight %}
### pause()
Pause the video playback. Returns: the player object
{% highlight javascript %}
myPlayer.pause();
{% endhighlight %}
### currentTime()
Returns the current time of the video in seconds.
{% highlight javascript %}
var whereYouAt = myPlayer.currentTime();
{% endhighlight %}
### currentTime(seconds) // Type: Integer or Float
Seek to the supplied time (seconds).
Returns the player object.
{% highlight javascript %}
myPlayer.currentTime(120); // 2 minutes into the video
{% endhighlight %}
### duration()
Returns the length in time of the video in seconds. NOTE: The video must have started loading before the duration can be known, and in the case of Flash, may not be known until the video starts playing.
{% highlight javascript %}
var howLongIsThis = myPlayer.duration();
{% endhighlight %}
### buffered()
Returns a [TimeRange](http://videojs.com/docs/glossary.html#timerange) with sections of the video that have been downloaded. If you just want the percent of the video that's been downloaded, use bufferedPercent.
{% highlight javascript %}
var whatHasBeenBuffered = myPlayer.buffered();
{% endhighlight %}
### bufferedPercent()
Returns the percent (as a decimal) of the video that's been downloaded.
{% highlight javascript %}
var howMuchIsDownloaded = myPlayer.bufferedPercent();
{% endhighlight %}
### volume()
Returns the current volume of the video as a percent in decimal form. 0 is off (muted), 1.0 is all the way up, 0.5 is half way.
{% highlight javascript %}
var howLoudIsIt = myPlayer.volume();
{% endhighlight %}
### volume(percentAsDecimal)
Set the volume to the supplied percent (as a decimal between 0 and 1).
{% highlight javascript %}
myPlayer.volume(0.5); // Set volume to half
{% endhighlight %}
### width()
Returns the current width of the video in pixels.
{% highlight javascript %}
var howWideIsIt = myPlayer.width();
{% endhighlight %}
### width(pixels)
Change the width of the video to the supplied width in pixels.
Returns the player object
{% highlight javascript %}
myPlayer.width(640);
{% endhighlight %}
### height()
Returns the current height of the video in pixels.
{% highlight javascript %}
var howTallIsIt = myPlayer.height();
{% endhighlight %}
### height(pixels)
Change the height of the video to the supplied height in pixels.
Returns the player object
{% highlight javascript %}
myPlayer.height(480);
{% endhighlight %}
### size(width, height)
Changes the width and height of the video to the supplied width and height. This is more efficient if you're changing both width and height (only triggers the player's resize event once). Returns the player object.
{% highlight javascript %}
myPlayer.size(640,480);
{% endhighlight %}
### requestFullScreen()
Increase the size of the video to full screen. In some browsers, full screen is not supported natively, so it enters full window mode, where the fills the browser window. In browsers that support native full screen, typically the browser's default controls will be shown, and not the Video.js custom skin. In full window mode, the Video.js controls and skin will always be used.
Returns the player object.
{% highlight javascript %}
myPlayer.enterFullScreen();
{% endhighlight %}
### cancelFullScreen()
Return the video to its normal size after having been in full screen mode.
Returns the player object.
{% highlight javascript %}
myPlayer.exitFullScreen();
{% endhighlight %}
Events
------
You can attach event listeners to the player similarly to how you would for a video element.
{% highlight javascript %}
var myFunc = function(){
// Do something when the event is fired
};
myPlayer.addEvent("eventName", myFunc);
{% endhighlight %}
You can also remove the listeners later.
{% highlight javascript %}
myPlayer.removeEvent("eventName", myFunc);
{% endhighlight %}
### Event Types
<table border="0" cellspacing="5" cellpadding="5">
<tr><th>Name</th><th>Description</th></tr>
<tr><td>loadstart</td><td>Fired when the user agent begins looking for media data.</td></tr>
<tr><td>play</td><td>Fired whenever the media begins or resumes playback.</td></tr>
<tr><td>pause</td><td>Fired whenever the media has been paused.</td></tr>
<tr><td>timeupdate</td><td>Fired when the current playback position has changed. During playback this is fired every 15-250 milliseconds, depnding on the playback technology in use.</td></tr>
<tr><td>ended</td><td>Fired when the end of the media resource is reached. currentTime == duration</td></tr>
<tr><td>durationchange</td><td>Fired when the duration of the media resource is changed, or known for the first time.</td></tr>
<tr><td>progress</td><td>Fired while the user agent is downloading media data.</td></tr>
<tr><td>resize</td><td>Fired when the width and/or height of the video window changes.</td></tr>
<tr><td>volumechange</td><td>Fired when the volume changes.</td></tr>
<tr><td>error</td><td>Fired when there is an error in playback.</td></tr>
</table>
-53
Ver Arquivo
@@ -1,53 +0,0 @@
Behaviors
=========
Behaviors allow you to make an element on your page act as a video control or a display of video information. The easiest example of this is creating a play button. The following code will make a click on your element play the video.
myPlayer.activateElement(myElement, "playButton");
mouseOverVideoReporter
The mouseOverVideoReporter behavior is mostly used internally to trigger showing the controls when a user's mouse is over the video. It's used on elements that are shown in front of the video, that might block a mouseover on the video itself from registering.
controlBar
The controlBar behavior is what's added to the main control bar to make it show/hide depending on the user's mouse and the set preferences. It can also be added to other elements if the same effect is desired.
playButton
The playButton behavior can be added to an element to make it play the video when clicked. (See also playToggle)
pauseButton
The pauseButton behavior can be added to an element to make it pause the video when clicked.
playToggle
The playToggle behavior can be added to an element to make it toggle between play and pause. When the video is playing it will pause the video, and vice versa. The play button in the default control bar works this way.
The icon in the play button changes to pause (two vertical bars) or play (triangle) depending on the state of the video. This is done through CSS classes. When the video is playing, a class of "vjs-playing" will be added to the playToggle element. When the video is paused, a class of "vjs-paused" will be added to the element. If you are using an image for the icon, set it as a background image of the element (or a sub element) and change the background image accordingly.
#my_play_toggle.vjs-playing { background-image: url("my-pause-icon.png") }
#my_play_toggle.vjs-paused { background-image: url("my-play-icon.png") }
playProgressBar
With the playProgressBar behavior, you can make an element grow like a progress bar as the video plays. The width of the element is set as a percent, and uses the video's current time divided by the video's total duration. For this reason, you may also need a container element to get the desired effect. In this example the width of the playProgressBar will be based on the width of myPlayProgressHolder.
<div id="myPlayProgressHolder">
<div id="myPlayProgressBar"></div>
</div>
loadProgressBar
The loadProgressBar behavior works similarly to the playProgressBar behavior, except that it's based on the amount of video data that's been downloaded to the users machine.
currentTimeDisplay
The currentTimeDisplay behavior will make an element display the video's current playback time in the format of 00:00. It does so by changing the innerHTML of the element to the time.
durationDisplay
The durationDisplay behavior will make an element display the video's duration in the format of 00:00. It does so by changing the innerHTML of the element to the duration.
currentTimeScrubber
The currentTimeScrubber behavior allows you to make an element that controls the current time of the video by clicking and dragging on the element. The current time will be set based on where the user clicks or drags to, in relation to the width of the element.
volumeDisplay
...
volumeScrubber
The volumeScrubber behavior allows you to make an element that controls the volume of the video by clicking and dragging on the element. The volume will be set based on where the user clicks or drags to, in relation to the width of the element.
fullscreenToggle
...
(Note to self: Have a video that is fixed position beside the behavior docs, that all examples are tied to)
-9
Ver Arquivo
@@ -1,9 +0,0 @@
Glossary
========
### DOM (Document Object Model)
The container of elements on the page that must be loaded before you can interact with the elements with through Javascript.
http://en.wikipedia.org/wiki/Document_Object_Model
### Flash Fallback
The Flash video player (SWF) used to play a video when HTML5 isn't supported.
+47
Ver Arquivo
@@ -0,0 +1,47 @@
---
layout: docs
title: VideoJS Glossary
description: Video.JS Glossary
body_id: glossary
body_class: docs subpage
---
Glossary
========
### DOM (Document Object Model)
The container of elements on the page that must be loaded before you can interact with the elements with through Javascript.
http://en.wikipedia.org/wiki/Document_Object_Model
### Flash Fallback
The Flash video player (SWF) used to play a video when HTML5 isn't supported.
<a name="timerange"></a>
### TimeRange
<a name="html5-video"></a>
### HTML5 Video
HTML is the markup language that makes up every page on the web. The newest version, HTML5, includes specifications for a video tag, that is meant to allow website developers to add a video to a page the same way they would add an image. In order for this to work, web browser developers (Mozilla, Apple, Microsoft, Google, Opera, etc.) have to build the video playback functionality into their browsers. The W3C has created directions on how video should work in browsers, and its up to browser developers to follow those directions, so that video works the same across all browsers. This doesnt always happen thanks to technology, legal, and financial choices made by browser developers, but so far no ones varying too far from the specifications. However the specifications are still being changed and refined, so browsers developers have to keep up with that as well.
Playing video in a web page may not seem so special since you can already view video on a web page through plugins like Flash Player, Quicktime, Silverlight, and RealPlayer, however this is a big step forward for standardizing video playback across web browsers and devices. The goal is that in the future, developers will only need to use one method for embedding a video, thats based on open standards (not controlled by one company), and it will work everywhere.
A prime example of this is the iPhone and iPad. Apple has decided not to support Flash on their mobile devices, but they do support HTML5 video. Since Flash is currently the most common way video is added to web pages, most web video (aside from YouTube who has a special relationship with Apple) cant be viewed on the iPhone or iPad. These devices are very popular, so many web sites are switching to hybrid HTML5/Flash player setups (like VideoJS).
<a name="video-tag"></a>
### Video Tag
There are a number of great resources that will give you an introduction to the video tag an how it is used including:
- [Dive into HTML5](http://diveintohtml5.org/video.html)
- Lynda.com's ['HTML5 Video and Audio in Depth'](http://www.lynda.com/HTML-5-tutorials/HTML5-Video-and-Audio-in-Depth/80781-2.html) video tutorials created by yours truly.
An if you really want to dig in, you can read the (W3C Spec)[http://www.w3.org/TR/html5/video.html]. (Warning - not for the faint of heart)
<a name="skin"></a>
### Skin
"Skin" refers to the design of the player's controls, also sometimes called the chrome. With VideoJS, new skins can be built simply by creating a new stylesheet.
<a name="cdn"></a>
### Content Delivery Network (CDN)
A network of servers around the world that host copies of a file. When your browser requests one of these files, the CDN automatically determines which server is closest to your location and delivers the file from there. This drastically increases delivery time, especially internationally.
+29
Ver Arquivo
@@ -0,0 +1,29 @@
---
layout: docs
title: Docs
description: Video.JS Docs
body_id: docs
body_class: docs subpage
---
<h1>Start</h1>
The Video.js documentation is here to help you setup and use the player. These docs can be found and contributed to in the [Video.js library repository](https://github.com/zencoder/video-js/tree/master/docs).
### [Setup](/docs/setup)
Check out the [5 second setup](/#setup) if you're just getting started. The setup documentation gives a deeper view of the additional methods you can use to trigger the player setup.
### [Options](/docs/options/)
There are a number of options that can be used to change how the player behaves, starting with the HTML5 media options like autoplay and preload, and expanding to Video.JS specific options.
### [API](/docs/api/)
The Video.js API allows you to control the video through javascript or trigger event listeners, whether the video is playing through HTML5, flash, or another playback technology.
### [Skins](/docs/skins/)
You can change the look of the player across playback technologies just by editing a CSS file. The skins documentation gives you a intro to how the HTML and CSS of the default skin is put together.
### [Tech](/docs/tech/)
A 'playback technology' is the term we're using to represent HTML5 video, Flash, and other video plugins, as well as other players like the YouTube player. Basically anything that has a unique API to audio or video. Additional playback technologies can be added relatively easily.
### [Glossary](/docs/glossary/)
Some helpful definitions.
+10
Ver Arquivo
@@ -0,0 +1,10 @@
---
layout: docs
title: Options
description: Player Options
body_id: options
body_class: docs subpage
---
Options
=======
+52
Ver Arquivo
@@ -0,0 +1,52 @@
---
layout: docs
title: Setup
description: Setup
body_id: setup
body_class: docs subpage
---
Setup
=====
Video.js is pretty easy to set up. It can take a matter of seconds to get the player up and working on your web page.
Step 1: Include the Video.js Javascript and CSS files in the head of your page.
------------------------------------------------------------------------------
You can download the Video.js source and host it on your own servers, or use the free CDN hosted version (thanks to Zencoder). It's often recommended now to put JavaScript before the end \</body\> tag instead of the head but Video.js includes an 'HTML5 Shiv', which needs to be in the \<head\> for older IE versions. If you
{% highlight html %}
<script src="http://vjs.zencdn.com/c/video.js"></script>
<link href="http://vjs.zencdn.com/c/video-js.css" rel="stylesheet">
{% endhighlight %}
It's often recommended now to include JavaScript before the end \</body\> tag instead of the \<head\>, but Video.js includes an 'HTML5 Shiv', which needs to be in the \<head\> for older IE versions.
Step 2: Add an HTML5 video tag to your page.
--------------------------------------------
Use the video tag as normal, with a few extra pieces for Video.js:
1. The 'data-setup' Atrribute tells Video.js to automatically set up the video when the page is ready, and read any options (in JSON format) from the attribute (see ['options'](http://videojs.com/docs/options.html)).
2. The 'id' Attribute: Should be used and unique for every video on the same page.
3. The 'class' attribute contains two classes:
- 'video-js' applies styles that are required for Video.js functionality, like fullscreen and subtitles.
- 'vjs-default-skin' applies the default skin to the HTML controls, and can be removed or overridden to create your own controls design.
Otherwise include/exclude attributes, settings, sources, and tracks exactly as you would for HTML5 video (see ['video-tag'](http://videojs.com/docs/video-tag.html)).
{% highlight html %}
<video id="example_video_1" class="video-js vjs-default-skin"
controls preload="auto" width="640" height="264"
poster="http://video-js.zencoder.com/oceans-clip.png"
data-setup='{"example_option":true}'>
<source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4' />
<source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm' />
<source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg' />
</video>
{% endhighlight %}
+10
Ver Arquivo
@@ -0,0 +1,10 @@
---
layout: docs
title: Skins
description: Controls Skins, Chrome, Design, look-and-feel.
body_id: skins
body_class: docs subpage
---
Skins
=====
+46
Ver Arquivo
@@ -0,0 +1,46 @@
---
layout: docs
title: Playback Technology
description: Video.js Playback Technology
body_id: tech
body_class: docs subpage
---
Playback Technology ("Tech")
============================
Playback Technology refers to the specific browser or plugin technology used to play the video or audio. When using HTML5, the playback technology is the video or audio element. When using Flash, the playback technology is the specific Flash player used, e.g. Flowplayer, YouTube Player, video-js.swf, etc. (not just "Flash"). This could also include Silverlight, Quicktime, or any other plugin that will play back video in the browser, as long as there is an API wrapper written for it.
Essentially we're using HTML5 and plugins only as video decoders, and using HTML and JavaScript to create a consistent API and skinning experience across all of them.
Building an API Wrapper
-----------------------
We'll write a more complete guide on writing a wrapper soon, but for now the best resource is the [Video.js](https://github.com/zencoder/video-js/tree/master/src) source where you can see how both the HTML5 and video-js.swf API wrappers were created.
Required Methods
----------------
canPlayType
play
pause
currentTime
volume
duration
buffered
supportsFullScreen
Required Events
---------------
loadstart
play
pause
playing
ended
volumechange
durationchange
error
Optional Events (include if supported)
--------------------------------------
timeupdate
progress
enterFullScreen
exitFullScreen
Diff do arquivo suprimido porque uma ou mais linhas são muito longas
Arquivo binário não exibido.
-116
Ver Arquivo
@@ -1,116 +0,0 @@
/*
VideoJS HuCSS Skin (http://videojs.com)
Version 2.0.0
*/
.hu-css .vjs-controls {
height: 47px; opacity: 0.95; color: #fff;
background: #3A3835;
}
.hu-css.video-js-box.vjs-controls-below .vjs-controls { background: #3A3835; }
.hu-css .vjs-controls > div {
top: 0;
background: none;
-webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0;
-webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none;
}
/* Top Level Items */
.hu-css .vjs-controls > div.vjs-play-control,
.hu-css .vjs-controls > div.vjs-volume-control,
.hu-css .vjs-controls > div.vjs-fullscreen-control {
bottom: 20px; height: 27px;
}
/* Bottom Level Items */
.hu-css .vjs-controls > div.vjs-progress-control, .hu-css .vjs-controls > div.vjs-time-control {
margin-top: 28px; height: 19px;
}
/* Placement of Control Items */
.hu-css .vjs-controls > div.vjs-play-control { width: 33px; left: 0px; }
.hu-css .vjs-controls > div.vjs-progress-control { width: left: 84px; right: 0; }
.hu-css .vjs-controls > div.vjs-time-control { width: 84px; left: 0px; }
.hu-css .vjs-controls > div.vjs-volume-control { width: 43px; right: 44px; }
.hu-css .vjs-controls > div.vjs-fullscreen-control { width: 43px; right: 0px; }
/* Play/Pause
-------------------------------------------------------------------------------- */
.hu-css.vjs-paused .vjs-play-control span { margin: 9px 0 0 12px; }
.hu-css.vjs-playing .vjs-play-control span { margin: 9px 0 0 12px; }
.hu-css .vjs-play-control:hover { background-color: #000; }
/* Progress
-------------------------------------------------------------------------------- */
.hu-css .vjs-progress-holder { /* Box containing play and load progresses */
height: 19px; border: none;
margin: 0px 0px 0 0px; /* Placement within the progress control item */
background: #000;
-webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0;
}
.hu-css .vjs-progress-holder div { height: 13px; margin-top: 3px; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; }
.hu-css .vjs-play-progress {
/* Default */ background: #777;
/* Webkit */ background: -webkit-gradient(linear, left top, left bottom, from(#999), to(#777));
/* Firefox */ background: -moz-linear-gradient(top, #999, #777);
}
.hu-css .vjs-load-progress { background: #555; }
/* Time Display
-------------------------------------------------------------------------------- */
.hu-css .vjs-controls .vjs-time-control { font-size: 11px; background: #000; }
.hu-css .vjs-controls .vjs-time-control span { line-height: 19px; /* Centering vertically */ }
/* Volume
-------------------------------------------------------------------------------- */
/*.hu-css .vjs-volume-control:hover { background-color: #000; }*/
.hu-css .vjs-volume-control div { margin: 0 5px 0 5px; padding: 9px 0 0 0; }
.hu-css .vjs-volume-control div span { /* Individual volume bars */
margin: 0 2px 0 0; /* Space between */
width: 3px; height: 0px; /* Total height is height + bottom border */
border-bottom: 12px solid #555; /* Default (off) color and height of visible portion */
}
.hu-css .vjs-volume-control div span.vjs-volume-level-on { border-color: #fff; /* Volume on bar color */ }
/* Creating differnt bar heights through height (transparent) and bottom border (visible). */
.hu-css .vjs-volume-control div span:nth-child(1) { border-bottom-width: 2px; height: 10px; }
.hu-css .vjs-volume-control div span:nth-child(2) { border-bottom-width: 4px; height: 8px; }
.hu-css .vjs-volume-control div span:nth-child(3) { border-bottom-width: 6px; height: 6px; }
.hu-css .vjs-volume-control div span:nth-child(4) { border-bottom-width: 8px; height: 4px; }
.hu-css .vjs-volume-control div span:nth-child(5) { border-bottom-width: 10px; height: 2px; }
/* Fullscreen
-------------------------------------------------------------------------------- */
.hu-css .vjs-fullscreen-control:hover { background-color: #000; }
.hu-css .vjs-fullscreen-control div { margin: 8px 0 0 0px; padding-left: 13px; height: 13px; border-left: 1px solid #555; }
.hu-css .vjs-fullscreen-control div span:nth-child(1) { margin-right: 9px; margin-bottom: 5px; border-top: 4px solid #fff; border-right: 4px solid rgba(0,0,0,0); }
.hu-css .vjs-fullscreen-control div span:nth-child(2) { border-top: 4px solid #fff; border-left: 4px solid rgba(0,0,0,0); }
.hu-css .vjs-fullscreen-control div span:nth-child(3) { clear: both; margin: 0 9px 0 0; border-bottom: 4px solid #fff; border-right: 4px solid rgba(0,0,0,0); }
.hu-css .vjs-fullscreen-control div span:nth-child(4) { border-bottom: 4px solid #fff; border-left: 4px solid rgba(0,0,0,0); }
/* Icon when video is in fullscreen mode */
.hu-css.vjs-fullscreen .vjs-fullscreen-control div span:nth-child(1) { border: none; border-bottom: 4px solid #fff; border-left: 4px solid rgba(0,0,0,0); }
.hu-css.vjs-fullscreen .vjs-fullscreen-control div span:nth-child(2) { border: none; border-bottom: 4px solid #fff; border-right: 4px solid rgba(0,0,0,0); }
.hu-css.vjs-fullscreen .vjs-fullscreen-control div span:nth-child(3) { border: none; border-top: 4px solid #fff; border-left: 4px solid rgba(0,0,0,0); }
.hu-css.vjs-fullscreen .vjs-fullscreen-control div span:nth-child(4) { border: none; border-top: 4px solid #fff; border-right: 4px solid rgba(0,0,0,0); }
/* Big Play Button (at start)
---------------------------------------------------------*/
.hu-css div.vjs-big-play-button {
width: 76px; height: 70px; margin: -35px 0 0 -38px;
border: 1px solid #ccc; opacity: 0.8;
-webkit-border-radius: 0px; -moz-border-radius: 0px; border-radius: 0px;
background: rgba(50,50,50,0.8);
/* CSS Shadows */
-webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none;
}
.hu-css div.vjs-big-play-button:hover {
-webkit-box-shadow: 0px 0px 80px #fff; -moz-box-shadow: 0px 0px 80px #fff; box-shadow: 0px 0px 80px #fff;
}
.hu-css div.vjs-big-play-button span {
margin: 16px 0 0 21px;
/* Drawing the play triangle with borders - http://www.infimum.dk/HTML/slantinfo.html */
border-left: 40px solid #fff; /* Width & Color of play icon */
/* Height of play icon is total top & bottom border widths. Color is transparent. */
border-top: 20px solid rgba(0,0,0,0); border-bottom: 20px solid rgba(0,0,0,0);
}
-111
Ver Arquivo
@@ -1,111 +0,0 @@
/*
VideoJS TubeCSS Skin (http://videojs.com)
Version 2.0.0
*/
.tube-css .vjs-controls {
opacity: 1; color: #000;
height: 24px;
bottom: 0;
background-color: #ccc;
background: #fcfcfc -webkit-gradient(linear, left top, left bottom, from(#fcfcfc), to(#d0d0d0)) left top;
background: #fcfcfc -moz-linear-gradient(top, #fcfcfc, #d0d0d0) left top;
}
.tube-css .vjs-controls > div {
height: 23px; margin: 0; background: none; top: 0;
border: 1px solid #b1b1b1; border-left-color: #eee;
-webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0;
-webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none;
}
/* Placement of Control Items */
.tube-css .vjs-controls > div.vjs-play-control { width: 25px; left: 0; }
.tube-css .vjs-controls > div.vjs-progress-control { left: 102px; right: 83px; }
.tube-css .vjs-controls > div.vjs-time-control { width: 75px; left: 27px; }
.tube-css .vjs-controls > div.vjs-volume-control { width: 50px; right: 30px; }
.tube-css .vjs-controls > div.vjs-fullscreen-control { width: 30px; right: 0; }
/* Removing borders on time & progress to join them */
.tube-css .vjs-controls > div.vjs-progress-control { border-left: none; }
.tube-css .vjs-controls > div.vjs-time-control { border-right: none; }
/* Play/Pause
-------------------------------------------------------------------------------- */
.tube-css .vjs-play-control { margin-left: 0; border-left-color: #b1b1b1; }
.tube-css.vjs-paused .vjs-play-control span { border-left-color: #333; border-top-width: 7px; border-left-width: 13px; border-bottom-width: 7px; margin: 5px 0 0 7px; }
.tube-css.vjs-playing .vjs-play-control span { height: 14px; margin: 5px auto 0; border-left: 4px solid #333; border-right: 4px solid #333; }
.tube-css.vjs-paused .vjs-play-control:hover span { border-left-color: #CF1A1A; }
.tube-css.vjs-playing .vjs-play-control:hover span { border-left-color: #CF1A1A; border-right-color: #CF1A1A; }
/* Time Display
-------------------------------------------------------------------------------- */
.tube-css .vjs-controls .vjs-time-control { font-size: 11px; }
.tube-css .vjs-controls .vjs-time-control span { line-height: 25px; /* Centering vertically */ }
/* Progress
-------------------------------------------------------------------------------- */
.tube-css .vjs-progress-holder {
margin-right: 10px;
background-color: #b1b1b1;
background: #b1b1b1 -webkit-gradient(linear, left top, left bottom, from(#b1b1b1), to(#cacaca)) left top;
background: #b1b1b1 -moz-linear-gradient(top, #b1b1b1, #cacaca) left top;
border-color: #CACACA; border-bottom-color: #eaeaea;
-webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0;
}
.tube-css .vjs-progress-control .vjs-load-progress { background: #C89191; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; }
.tube-css .vjs-progress-control .vjs-play-progress { background: #f33; background: -webkit-gradient(linear, left top, left bottom, from(#f33), to(#CF1A1A)); background: -moz-linear-gradient(top, #f33, #CF1A1A); -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; }
/* Volume
-------------------------------------------------------------------------------- */
.tube-css .vjs-volume-control div { padding: 3px 0 0 0; }
.tube-css .vjs-volume-control div span { border-bottom-color: #ccc; }
/* Volume icon color */
.tube-css .vjs-volume-control div span.vjs-volume-level-on { border-color: #333; }
/* Volume icon hovering color */
.tube-css .vjs-volume-control:hover div span.vjs-volume-level-on { border-color: #CF1A1A; }
/* Fullscreen
-------------------------------------------------------------------------------- */
.tube-css .vjs-fullscreen-control div { margin: 4px 0 0 8px; }
/* Fullscreen icon color */
.tube-css .vjs-fullscreen-control div span:nth-child(3), .tube-css .vjs-fullscreen-control div span:nth-child(4), .tube-css.vjs-fullscreen .vjs-fullscreen-control div span:nth-child(1), .tube-css.vjs-fullscreen .vjs-fullscreen-control div span:nth-child(2) {
border-bottom-color: #333;
}
.tube-css .vjs-fullscreen-control div span:nth-child(1), .tube-css .vjs-fullscreen-control div span:nth-child(2), .tube-css.vjs-fullscreen .vjs-fullscreen-control div span:nth-child(3), .tube-css.vjs-fullscreen .vjs-fullscreen-control div span:nth-child(4) {
border-top-color: #333;
}
/* Fullscreen icon hovering color */
.tube-css .vjs-fullscreen-control:hover div span:nth-child(3), .tube-css .vjs-fullscreen-control:hover div span:nth-child(4), .tube-css.vjs-fullscreen .vjs-fullscreen-control:hover div span:nth-child(1), .tube-css.vjs-fullscreen .vjs-fullscreen-control:hover div span:nth-child(2) {
border-bottom-color: #CF1A1A;
}
.tube-css .vjs-fullscreen-control:hover div span:nth-child(1), .tube-css .vjs-fullscreen-control:hover div span:nth-child(2), .tube-css.vjs-fullscreen .vjs-fullscreen-control:hover div span:nth-child(3), .tube-css.vjs-fullscreen .vjs-fullscreen-control:hover div span:nth-child(4) {
border-top-color: #CF1A1A;
}
/* Big Play Button (at start)
---------------------------------------------------------*/
.tube-css div.vjs-big-play-button {
width: 84px; height: 58px; margin: -29px 0 0 -42px;
border: 2px solid #ccc; opacity: 0.9;
-webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px;
/* CSS Background Gradients */
/* Default */ background-color: #333;
/* Webkit */ background: #000 -webkit-gradient(linear, left top, left bottom, from(#000), to(#333)) left 29px;
/* Firefox */ background: #000 -moz-linear-gradient(top, #000, #333) left 29px;
/* CSS Shadows */
-webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none;
}
.tube-css div.vjs-big-play-button:hover {
opacity: 1;
}
.tube-css div.vjs-big-play-button span {
margin: 11px 0 0 26px;
/* Drawing the play triangle with borders - http://www.infimum.dk/HTML/slantinfo.html */
border-left: 36px solid #fff; /* Width & Color of play icon */
/* Height of play icon is total top & bottom border widths. Color is transparent. */
border-top: 18px solid rgba(0,0,0,0); border-bottom: 18px solid rgba(0,0,0,0);
}
-89
Ver Arquivo
@@ -1,89 +0,0 @@
/*
VideoJS VimCSS Skin (http://videojs.com)
Version 2.0.0
*/
.vim-css .vjs-controls {
height: 60px; opacity: 0.9; color: #fff;
}
.vim-css .vjs-controls > div {
height: 32px; top: 18px; padding: 0; text-align: center; background: rgba(23, 35, 34, 0.746094);
-webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0;
-webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none;
}
/* Placement of Control Items */
.vim-css .vjs-controls > div.vjs-play-control { width: 65px; left: 10px; }
.vim-css .vjs-controls > div.vjs-progress-control { left: 85px; right: 160px; }
.vim-css .vjs-controls > div.vjs-time-control { width: 75px; right: 85px; }
.vim-css .vjs-controls > div.vjs-volume-control { width: 50px; right: 35px; }
.vim-css .vjs-controls > div.vjs-fullscreen-control { width: 25px; right: 10px; }
/* Play/Pause
-------------------------------------------------------------------------------- */
.vim-css .vjs-controls .vjs-play-control { top: 10px; margin: 0; height: 40px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; }
.vim-css .vjs-play-control:hover { background: #00ADEF; }
.vim-css.vjs-paused .vjs-play-control span { border-left-color: #fff; border-top-width: 9px; border-left-width: 18px; border-bottom-width: 9px; margin: 11px 0 0 24px; }
.vim-css.vjs-playing .vjs-play-control span { width: 5px; height: 18px; margin: 5px auto 0; border-left: 5px solid #fff; border-right: 5px solid #fff; margin: 11px 0 0 24px; }
/* Progress
-------------------------------------------------------------------------------- */
.vim-css .vjs-controls .vjs-progress-control { -webkit-border-radius: 5px 0 0 5px; -moz-border-radius: 5px 0 0 5px; border-radius: 5px 0 0 5px; }
.vim-css .vjs-progress-control .vjs-progress-holder { height: 8px; padding: 1px; margin: 10px 5px 0 10px; border-color: #666666; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; }
.vim-css .vjs-progress-control .vjs-play-progress { height: 8px; background: #00ADEF; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; }
.vim-css .vjs-progress-control .vjs-load-progress { height: 8px; background: #898F8F; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; }
/* Time Display
-------------------------------------------------------------------------------- */
.vim-css .vjs-controls .vjs-time-control { font-size: 11px; }
.vim-css .vjs-controls .vjs-time-control span { line-height: 32px; /* Centering vertically */ }
/* Volume
-------------------------------------------------------------------------------- */
.vim-css .vjs-volume-control div { padding: 7px 0 0 5px; width: 30px; }
.vim-css .vjs-volume-control div span {
float: left; margin: 0 2px 0 0; padding: 0; width: 3px; height: 3px; border-bottom: 12px solid #666666;
-webkit-transition: all 100ms linear; -moz-transition: all 100ms linear;
}
.vim-css .vjs-volume-control div span.vjs-volume-level-on { border-color: #00ADEF; }
.vim-css .vjs-volume-control div span:hover { height: 0; border-bottom-width: 15px; }
/* Fullscreen
-------------------------------------------------------------------------------- */
.vim-css .vjs-fullscreen-control div { margin: 10px 0 0 0; }
.vim-css .vjs-controls .vjs-fullscreen-control { -webkit-border-radius: 0 5px 5px 0; -moz-border-radius: 0 5px 5px 0; border-radius: 0 5px 5px 0; }
/* Making default fullscreen icon smaller */
.vim-css .vjs-fullscreen-control div span:nth-child(1) { margin: 0 4px 4px 0; border: none; border-top: 4px solid #fff; border-right: 4px solid rgba(0,0,0,0); }
.vim-css .vjs-fullscreen-control div span:nth-child(2) { border: none; border-top: 4px solid #fff; border-left: 4px solid rgba(0,0,0,0); }
.vim-css .vjs-fullscreen-control div span:nth-child(3) { clear: both; margin: 0 4px 0 0; border: none; border-bottom: 4px solid #fff; border-right: 4px solid rgba(0,0,0,0); }
.vim-css .vjs-fullscreen-control div span:nth-child(4) { border: none; border-bottom: 4px solid #fff; border-left: 4px solid rgba(0,0,0,0); }
.vim-css.vjs-fullscreen .vjs-fullscreen-control div span:nth-child(1) { border: none; border-bottom: 4px solid #fff; border-left: 4px solid rgba(0,0,0,0); }
.vim-css.vjs-fullscreen .vjs-fullscreen-control div span:nth-child(2) { border: none; border-bottom: 4px solid #fff; border-right: 4px solid rgba(0,0,0,0); }
.vim-css.vjs-fullscreen .vjs-fullscreen-control div span:nth-child(3) { border: none; border-top: 4px solid #fff; border-left: 4px solid rgba(0,0,0,0); }
.vim-css.vjs-fullscreen .vjs-fullscreen-control div span:nth-child(4) { border: none; border-top: 4px solid #fff; border-right: 4px solid rgba(0,0,0,0); }
/* Fullscreen control hovering */
.vim-css .vjs-fullscreen-control:hover div span:nth-child(3), .vim-css .vjs-fullscreen-control:hover div span:nth-child(4), .vim-css.vjs-fullscreen .vjs-fullscreen-control:hover div span:nth-child(1), .vim-css.vjs-fullscreen .vjs-fullscreen-control:hover div span:nth-child(2) { border-bottom-color: #00ADEF; }
.vim-css .vjs-fullscreen-control:hover div span:nth-child(1), .vim-css .vjs-fullscreen-control:hover div span:nth-child(2), .vim-css.vjs-fullscreen .vjs-fullscreen-control:hover div span:nth-child(3), .vim-css.vjs-fullscreen .vjs-fullscreen-control:hover div span:nth-child(4) { border-top-color: #00ADEF; }
/* Big Play Button (at start)
---------------------------------------------------------*/
.vim-css div.vjs-big-play-button {
width: 130px; height: 80px; margin: -40px 0 0 -65px;
border: none; opacity: 0.9;
-webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px;
background: rgba(23, 35, 34, 0.746094);
/* CSS Shadows */
-webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none;
}
.vim-css div.vjs-big-play-button:hover {
background: #00ADEF;
opacity: 1;
}
.vim-css div.vjs-big-play-button span {
margin: 22px 0 0 48px;
/* Drawing the play triangle with borders - http://www.infimum.dk/HTML/slantinfo.html */
border-left: 36px solid #fff; /* Width & Color of play icon */
/* Height of play icon is total top & bottom border widths. Color is transparent. */
border-top: 18px solid rgba(0,0,0,0); border-bottom: 18px solid rgba(0,0,0,0);
}
+9 -8
Ver Arquivo
@@ -1,24 +1,25 @@
/*
VideoJS - HTML5 Video Player
v2.0.2
/*!
Video.js - HTML5 Video Player
Version 3.0 BETA
This file is part of VideoJS. Copyright 2010 Zencoder, Inc.
LGPL v3 LICENSE INFO
This file is part of Video.js. Copyright 2011 Zencoder, Inc.
VideoJS is free software: you can redistribute it and/or modify
Video.js is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
VideoJS is distributed in the hope that it will be useful,
Video.js is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with VideoJS. If not, see <http://www.gnu.org/licenses/>.
along with Video.js. If not, see <http://www.gnu.org/licenses/>.
*/
// Self-executing function to prevent global vars and help with minification
(function(window, undefined){
;(function(window, undefined){
var document = window.document;
+3
Ver Arquivo
@@ -2,5 +2,8 @@
// Expose to global
window.VideoJS = window._V_ = VideoJS;
// Run Auto-load players
_V_.autoSetup();
// End self-executing function
})(window);
+188
Ver Arquivo
@@ -0,0 +1,188 @@
// Using John Resig's Class implementation http://ejohn.org/blog/simple-javascript-inheritance/
// (function(){var initializing=false, fnTest=/xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/; _V_.Class = function(){}; _V_.Class.extend = function(prop) { var _super = this.prototype; initializing = true; var prototype = new this(); initializing = false; for (var name in prop) { prototype[name] = typeof prop[name] == "function" && typeof _super[name] == "function" && fnTest.test(prop[name]) ? (function(name, fn){ return function() { var tmp = this._super; this._super = _super[name]; var ret = fn.apply(this, arguments); this._super = tmp; return ret; }; })(name, prop[name]) : prop[name]; } function Class() { if ( !initializing && this.init ) this.init.apply(this, arguments); } Class.prototype = prototype; Class.constructor = Class; Class.extend = arguments.callee; return Class;};})();
(function(){
var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
_V_.Class = function(){};
_V_.Class.extend = function(prop) {
var _super = this.prototype;
initializing = true;
var prototype = new this();
initializing = false;
for (var name in prop) {
prototype[name] = typeof prop[name] == "function" &&
typeof _super[name] == "function" && fnTest.test(prop[name]) ?
(function(name, fn){
return function() {
var tmp = this._super;
this._super = _super[name];
var ret = fn.apply(this, arguments);
this._super = tmp;
return ret;
};
})(name, prop[name]) :
prop[name];
}
function Class() {
if ( !initializing && this.init ) {
return this.init.apply(this, arguments);
// Attempting to recreate accessing function form of class.
} else if (!initializing) {
return arguments.callee.prototype.init()
}
}
Class.prototype = prototype;
Class.constructor = Class;
Class.extend = arguments.callee;
return Class;
};
})();
/* Player Component- Base class for all UI objects
================================================================================ */
_V_.Component = _V_.Class.extend({
init: function(player, options){
this.player = player;
if (options && options.el) {
this.el = options.el;
} else {
this.el = this.createElement();
}
// Array of sub-components
if (options && options.components) {
_V_.each.call(this, options.components, function(comp){
this.addComponent(comp);
});
}
},
destroy: function(){},
createElement: function(type, attrs){
return _V_.createElement(type || "div", attrs);
},
buildCSSClass: function(){
// Child classes can include a function that does:
// return "CLASS NAME" + this._super();
return "";
},
// Add child components to this component.
// Will generate a new child component and then append child component's element to this component's element.
// Takes either the name of the UI component class, or an object that contains a name, UI Class, and options.
addComponent: function(nameORobj){
var name, componentClass, options, component;
if (typeof nameORobj == "string") {
name = nameORobj;
// Can also pass in object to define a different class than the name and add other options
} else {
name = nameORobj.name;
componentClass = nameORobj.componentClass;
options = nameORobj.options;
}
if (!componentClass) {
// Assume name of set is a lowercased name of the UI Class (PlayButton, etc.)
componentClass = _V_.capitalize(name);
}
// Create a new object & element for this controls set
// If there's no .player, this is a player
component = new _V_[componentClass](this.player || this, options);
if (this.components === undefined) {
this.components = [];
}
this.components.push(component);
// Add the UI object's element to the container div (box)
this.el.appendChild(component.el);
},
/* Display
================================================================================ */
show: function(){
this.el.style.display = "block";
},
hide: function(){
this.el.style.display = "none";
},
addClass: function(classToAdd){
_V_.addClass(this.el, classToAdd);
},
removeClass: function(classToRemove){
_V_.removeClass(this.el, classToRemove);
},
/* Events
================================================================================ */
addEvent: function(type, fn){
return _V_.addEvent(this.el, type, _V_.proxy(this, fn));
},
removeEvent: function(type, fn){
return _V_.removeEvent(this.el, type, fn);
},
triggerEvent: function(type, e){
return _V_.triggerEvent(this.el, type, e);
},
/* Ready - Trigger functions when component is ready
================================================================================ */
ready: function(fn){
if (!fn) return this;
if (this.isReady) {
fn.call(this);
} else {
if (this.readyQueue === undefined) {
this.readyQueue = [];
}
this.readyQueue.push(fn);
}
return this;
},
triggerReady: function(){
this.isReady = true;
if (this.readyQueue && this.readyQueue.length > 0) {
// Call all functions in ready queue
this.each(this.readyQueue, function(fn){
fn.call(this);
});
// Reset Ready Queue
this.readyQueue = [];
}
},
/* Utility
================================================================================ */
each: function(arr, fn){
if (!arr || arr.length === 0) { return; }
for (var i=0,j=arr.length; i<j; i++) {
if (fn.call(this, arr[i], i)) { break; }
}
},
extend: function(obj){
for (var attrname in obj) {
if (obj.hasOwnProperty(attrname)) { this[attrname]=obj[attrname]; }
}
},
// More easily attach 'this' to functions
proxy: function(fn){
return _V_.proxy(this, fn);
}
});
+791
Ver Arquivo
@@ -0,0 +1,791 @@
/* Control - Base class for all control elements
================================================================================ */
_V_.Control = _V_.Component.extend({
buildCSSClass: function(){
return "vjs-control " + this._super();
}
});
/* Button - Base class for all buttons
================================================================================ */
_V_.Button = _V_.Control.extend({
init: function(player, options){
this._super(player, options);
this.addEvent("click", this.onClick);
this.addEvent("focus", this.onFocus);
this.addEvent("blur", this.onBlur);
},
createElement: function(type, attrs){
// Add standard Aria and Tabindex info
attrs = _V_.merge({
className: this.buildCSSClass(),
innerHTML: '<div><span class="vjs-control-text">' + (this.buttonText || "Need Text") + '</span></div>',
role: "button",
tabIndex: 0
}, attrs);
return this._super(type, attrs);
},
// Click - Override with specific functionality for button
onClick: function(){},
// Focus - Add keyboard functionality to element
onFocus: function(){
_V_.addEvent(document, "keyup", _V_.proxy(this, this.onKeyPress));
},
// KeyPress (document level) - Trigger click when keys are pressed
onKeyPress: function(event){
// Check for space bar (32) or enter (13) keys
if (event.which == 32 || event.which == 13) {
event.preventDefault();
this.onClick();
}
},
// Blur - Remove keyboard triggers
onBlur: function(){
_V_.removeEvent(document, "keyup", _V_.proxy(this, this.onKeyPress));
}
});
/* Play Button
================================================================================ */
_V_.PlayButton = _V_.Button.extend({
buttonText: "Play",
buildCSSClass: function(){
return "vjs-play-button " + this._super();
},
onClick: function(){
this.player.play();
}
});
/* Pause Button
================================================================================ */
_V_.PauseButton = _V_.Button.extend({
buttonText: "Pause",
buildCSSClass: function(){
return "vjs-pause-button " + this._super();
},
onClick: function(){
this.player.pause();
}
});
/* Play Toggle - Play or Pause Media
================================================================================ */
_V_.PlayToggle = _V_.Button.extend({
buttonText: "Play",
init: function(player, options){
this._super(player, options);
player.addEvent("play", _V_.proxy(this, this.onPlay));
player.addEvent("pause", _V_.proxy(this, this.onPause));
},
buildCSSClass: function(){
return "vjs-play-control " + this._super();
},
// OnClick - Toggle between play and pause
onClick: function(){
if (this.player.paused()) {
this.player.play();
} else {
this.player.pause();
}
},
// OnPlay - Add the vjs-playing class to the element so it can change appearance
onPlay: function(){
_V_.removeClass(this.el, "vjs-paused");
_V_.addClass(this.el, "vjs-playing");
},
// OnPause - Add the vjs-paused class to the element so it can change appearance
onPause: function(){
_V_.removeClass(this.el, "vjs-playing");
_V_.addClass(this.el, "vjs-paused");
}
});
/* Fullscreen Toggle Behaviors
================================================================================ */
_V_.FullscreenToggle = _V_.Button.extend({
buttonText: "Fullscreen",
buildCSSClass: function(){
return "vjs-fullscreen-control " + this._super();
},
onClick: function(){
if (!this.player.videoIsFullScreen) {
this.player.requestFullScreen();
} else {
this.player.cancelFullScreen();
}
}
});
/* Big Play Button
================================================================================ */
_V_.BigPlayButton = _V_.Button.extend({
init: function(player, options){
this._super(player, options);
player.addEvent("play", _V_.proxy(this, this.hide));
player.addEvent("ended", _V_.proxy(this, this.show));
},
createElement: function(){
return this._super("div", {
className: "vjs-big-play-button",
innerHTML: "<span></span>"
});
},
onClick: function(){
// Go back to the beginning if big play button is showing at the end.
// Have to check for current time otherwise it might throw a 'not ready' error.
if(this.player.currentTime()) {
this.player.currentTime(0);
}
this.player.play();
}
});
/* Loading Spinner
================================================================================ */
_V_.LoadingSpinner = _V_.Component.extend({
init: function(player, options){
this._super(player, options);
player.addEvent("canplay", _V_.proxy(this, this.hide));
player.addEvent("canplaythrough", _V_.proxy(this, this.hide));
player.addEvent("playing", _V_.proxy(this, this.hide));
player.addEvent("seeking", _V_.proxy(this, this.show));
player.addEvent("error", _V_.proxy(this, this.show));
player.addEvent("stalled", _V_.proxy(this, this.show));
player.addEvent("waiting", _V_.proxy(this, this.show));
},
createElement: function(){
var classNameSpinner, innerHtmlSpinner;
if ( typeof this.player.el.style.WebkitBorderRadius == "string"
|| typeof this.player.el.style.MozBorderRadius == "string"
|| typeof this.player.el.style.KhtmlBorderRadius == "string"
|| typeof this.player.el.style.borderRadius == "string")
{
classNameSpinner = "vjs-loading-spinner";
innerHtmlSpinner = "<div class='ball1'></div><div class='ball2'></div><div class='ball3'></div><div class='ball4'></div><div class='ball5'></div><div class='ball6'></div><div class='ball7'></div><div class='ball8'></div>";
} else {
classNameSpinner = "vjs-loading-spinner-fallback";
innerHtmlSpinner = "";
}
return this._super("div", {
className: classNameSpinner,
innerHTML: innerHtmlSpinner
});
}
});
/* Control Bar
================================================================================ */
_V_.ControlBar = _V_.Component.extend({
init: function(player, options){
this._super(player, options);
player.addEvent("play", this.proxy(this.show));
player.addEvent("mouseover", this.proxy(this.reveal));
player.addEvent("mouseout", this.proxy(this.conceal));
},
createElement: function(){
return _V_.createElement("div", {
className: "vjs-controls"
});
},
// Used for transitions (fading out)
reveal: function(){
this.el.style.opacity = 1;
},
conceal: function(){
this.el.style.opacity = 0;
}
});
/* Time
================================================================================ */
_V_.CurrentTimeDisplay = _V_.Component.extend({
init: function(player, options){
this._super(player, options);
player.addEvent("timeupdate", _V_.proxy(this, this.updateContent));
},
createElement: function(){
var el = this._super("div", {
className: "vjs-current-time vjs-time-controls vjs-control"
});
this.content = _V_.createElement("div", {
className: "vjs-current-time-display",
innerHTML: '0:00'
});
el.appendChild(_V_.createElement("div").appendChild(this.content));
return el;
},
updateContent: function(){
// Allows for smooth scrubbing, when player can't keep up.
var time = (this.player.scrubbing) ? this.player.values.currentTime : this.player.currentTime();
this.content.innerHTML = _V_.formatTime(time, this.player.duration());
}
});
_V_.DurationDisplay = _V_.Component.extend({
init: function(player, options){
this._super(player, options);
player.addEvent("timeupdate", _V_.proxy(this, this.updateContent));
},
createElement: function(){
var el = this._super("div", {
className: "vjs-duration vjs-time-controls vjs-control"
});
this.content = _V_.createElement("div", {
className: "vjs-duration-display",
innerHTML: '0:00'
});
el.appendChild(_V_.createElement("div").appendChild(this.content));
return el;
},
updateContent: function(){
if (this.player.duration()) { this.content.innerHTML = _V_.formatTime(this.player.duration()); }
}
});
// Time Separator (Not used in main skin, but still available, and could be used as a 'spare element')
_V_.TimeDivider = _V_.Component.extend({
createElement: function(){
return this._super("div", {
className: "vjs-time-divider",
innerHTML: '<div><span>/</span></div>'
});
}
});
_V_.RemainingTimeDisplay = _V_.Component.extend({
init: function(player, options){
this._super(player, options);
player.addEvent("timeupdate", _V_.proxy(this, this.updateContent));
},
createElement: function(){
var el = this._super("div", {
className: "vjs-remaining-time vjs-time-controls vjs-control"
});
this.content = _V_.createElement("div", {
className: "vjs-remaining-time-display",
innerHTML: '-0:00'
});
el.appendChild(_V_.createElement("div").appendChild(this.content));
return el;
},
updateContent: function(){
if (this.player.duration()) { this.content.innerHTML = "-"+_V_.formatTime(this.player.remainingTime()); }
// Allows for smooth scrubbing, when player can't keep up.
// var time = (this.player.scrubbing) ? this.player.values.currentTime : this.player.currentTime();
// this.content.innerHTML = _V_.formatTime(time, this.player.duration());
}
});
/* Slider - Parent for seek bar and volume slider
================================================================================ */
_V_.Slider = _V_.Component.extend({
init: function(player, options){
this._super(player, options);
_V_.each.call(this, this.components, function(comp){
if (comp instanceof _V_[this.barClass]) {
this.bar = comp;
} else if (comp instanceof _V_[this.handleClass]) {
this.handle = comp;
}
});
player.addEvent(this.playerEvent, _V_.proxy(this, this.update));
this.addEvent("mousedown", this.onMouseDown);
this.addEvent("focus", this.onFocus);
this.addEvent("blur", this.onBlur);
// Update Display
// Need to wait for styles to be loaded.
// TODO - replace setTimeout with stylesReady function.
setTimeout(this.proxy(this.update), 0);
},
createElement: function(type, attrs) {
attrs = _V_.merge({
role: "slider",
"aria-valuenow": 0,
"aria-valuemin": 0,
"aria-valuemax": 100,
tabIndex: 0
}, attrs);
return this._super(type, attrs);
},
onMouseDown: function(event){
event.preventDefault();
_V_.blockTextSelection();
_V_.addEvent(document, "mousemove", _V_.proxy(this, this.onMouseMove));
_V_.addEvent(document, "mouseup", _V_.proxy(this, this.onMouseUp));
this.onMouseMove(event);
},
onMouseUp: function(event) {
_V_.unblockTextSelection();
_V_.removeEvent(document, "mousemove", this.onMouseMove, false);
_V_.removeEvent(document, "mouseup", this.onMouseUp, false);
this.update();
},
update: function(){
// If scrubbing, we could use a cached value to make the handle keep up with the user's mouse.
// On HTML5 browsers scrubbing is really smooth, but some flash players are slow, so we might want to utilize this later.
// var progress = (this.player.scrubbing) ? this.player.values.currentTime / this.player.duration() : this.player.currentTime() / this.player.duration();
var progress = this.getPercent();
handle = this.handle,
bar = this.bar,
barProgress = progress;
// Protect against no duration and other division issues
if (isNaN(progress)) { progress = 0; }
// If there is a handle, we need to account for the handle in our calculation for progress bar
// so that it doesn't fall short of or extend past the handle.
if (handle) {
var box = this.el,
boxWidth = box.offsetWidth,
// The width of the handle in percent of the containing box
handlePercent = handle.el.offsetWidth / boxWidth,
// Get the adjusted size of the box, considering that the handle's center never touches the left or right side.
// There is a margin of half the handle's width on both sides.
boxAdjustedPercent = 1 - handlePercent;
// Adjust the progress that we'll use to set widths to the new adjusted box width
adjustedProgress = progress * boxAdjustedPercent,
// The bar does reach the left side, so we need to account for this in the bar's width
barProgress = adjustedProgress + (handlePercent / 2);
// Move the handle from the left based on the adjected progress
handle.el.style.left = _V_.round(adjustedProgress * 100, 2) + "%";
}
// Set the new bar width
bar.el.style.width = _V_.round(barProgress * 100, 2) + "%";
},
calculateDistance: function(event){
var box = this.el,
boxX = _V_.findPosX(box),
boxW = box.offsetWidth,
handle = this.handle;
if (handle) {
var handleW = handle.el.offsetWidth;
// Adjusted X and Width, so handle doesn't go outside the bar
boxX = boxX + (handleW / 2);
boxW = boxW - handleW;
}
// Percent that the click is through the adjusted area
return Math.max(0, Math.min(1, (event.pageX - boxX) / boxW));
},
onFocus: function(event){
_V_.addEvent(document, "keyup", _V_.proxy(this, this.onKeyPress));
},
onKeyPress: function(event){
if (event.which == 37) { // Left Arrow
event.preventDefault();
this.stepBack();
} else if (event.which == 39) { // Right Arrow
event.preventDefault();
this.stepForward();
}
},
onBlur: function(event){
_V_.removeEvent(document, "keyup", _V_.proxy(this, this.onKeyPress));
}
});
/* Progress
================================================================================ */
// Progress Control: Seek, Load Progress, and Play Progress
_V_.ProgressControl = _V_.Component.extend({
createElement: function(){
return this._super("div", {
className: "vjs-progress-control vjs-control"
});
}
});
// Seek Bar and holder for the progress bars
_V_.SeekBar = _V_.Slider.extend({
barClass: "PlayProgressBar",
handleClass: "SeekHandle",
playerEvent: "timeupdate",
init: function(player, options){
this._super(player, options);
},
createElement: function(){
return this._super("div", {
className: "vjs-progress-holder"
});
},
getPercent: function(){
return this.player.currentTime() / this.player.duration();
},
onMouseDown: function(event){
this._super(event);
this.player.scrubbing = true;
this.videoWasPlaying = !this.player.paused();
this.player.pause();
},
onMouseMove: function(event){
var newTime = this.calculateDistance(event) * this.player.duration();
// Don't let video end while scrubbing.
if (newTime == this.player.duration()) { newTime = newTime - 0.1; }
// Set new time (tell player to seek to new time)
this.player.currentTime(newTime);
},
onMouseUp: function(event){
this._super(event);
this.player.scrubbing = false;
if (this.videoWasPlaying) {
this.player.play();
}
},
stepForward: function(){
this.player.currentTime(this.player.currentTime() + 1);
},
stepBack: function(){
this.player.currentTime(this.player.currentTime() - 1);
}
});
// Load Progress Bar
_V_.LoadProgressBar = _V_.Component.extend({
init: function(player, options){
this._super(player, options);
player.addEvent("progress", _V_.proxy(this, this.update));
},
createElement: function(){
return this._super("div", {
className: "vjs-load-progress",
innerHTML: '<span class="vjs-control-text">Loaded: 0%</span>'
});
},
update: function(){
if (this.el.style) { this.el.style.width = _V_.round(this.player.bufferedPercent() * 100, 2) + "%"; }
}
});
// Play Progress Bar
_V_.PlayProgressBar = _V_.Component.extend({
createElement: function(){
return this._super("div", {
className: "vjs-play-progress",
innerHTML: '<span class="vjs-control-text">Progress: 0%</span>'
});
}
});
// Seek Handle
// SeekBar Behavior includes play progress bar, and seek handle
// Needed so it can determine seek position based on handle position/size
_V_.SeekHandle = _V_.Component.extend({
createElement: function(){
return this._super("div", {
className: "vjs-seek-handle",
innerHTML: '<span class="vjs-control-text">00:00</span>'
});
}
});
/* Volume Scrubber
================================================================================ */
// Progress Control: Seek, Load Progress, and Play Progress
_V_.VolumeControl = _V_.Component.extend({
createElement: function(){
return this._super("div", {
className: "vjs-volume-control vjs-control"
});
}
});
_V_.VolumeBar = _V_.Slider.extend({
barClass: "VolumeLevel",
handleClass: "VolumeHandle",
playerEvent: "volumechange",
createElement: function(){
return this._super("div", {
className: "vjs-volume-bar"
});
},
onMouseMove: function(event) {
this.player.volume(this.calculateDistance(event));
},
getPercent: function(){
return this.player.volume();
},
stepForward: function(){
this.player.volume(this.player.volume() + 0.1);
},
stepBack: function(){
this.player.volume(this.player.volume() - 0.1);
}
});
_V_.VolumeLevel = _V_.Component.extend({
createElement: function(){
return this._super("div", {
className: "vjs-volume-level",
innerHTML: '<span class="vjs-control-text"></span>'
});
}
});
_V_.VolumeHandle = _V_.Component.extend({
createElement: function(){
return this._super("div", {
className: "vjs-volume-handle",
innerHTML: '<span class="vjs-control-text"></span>'
// tabindex: 0,
// role: "slider", "aria-valuenow": 0, "aria-valuemin": 0, "aria-valuemax": 100
});
}
});
_V_.MuteToggle = _V_.Button.extend({
init: function(player, options){
this._super(player, options);
player.addEvent("volumechange", _V_.proxy(this, this.update));
},
createElement: function(){
return this._super("div", {
className: "vjs-mute-control vjs-control",
innerHTML: '<div><span class="vjs-control-text">Mute</span></div>'
});
},
onClick: function(event){
this.player.muted( this.player.muted() ? false : true );
},
update: function(event){
var vol = this.player.volume(),
level = 3;
if (vol == 0 || this.player.muted()) {
level = 0;
} else if (vol < 0.33) {
level = 1;
} else if (vol < 0.67) {
level = 2;
}
/* TODO improve muted icon classes */
_V_.each.call(this, [0,1,2,3], function(i){
_V_.removeClass(this.el, "vjs-vol-"+i);
});
_V_.addClass(this.el, "vjs-vol-"+level);
}
});
/* Poster Image
================================================================================ */
_V_.Poster = _V_.Button.extend({
init: function(player, options){
this._super(player, options);
if (!this.player.options.poster) {
this.hide();
}
player.addEvent("play", _V_.proxy(this, this.hide));
},
createElement: function(){
return this._super("img", {
className: "vjs-poster",
src: this.player.options.poster,
// Don't want poster to be tabbable.
tabIndex: -1
});
},
onClick: function(){
this.player.play();
}
});
/* Text Track Displays
================================================================================ */
// Create a behavior type for each text track type (subtitlesDisplay, captionsDisplay, etc.).
// Then you can easily do something like.
// player.addBehavior(myDiv, "subtitlesDisplay");
// And the myDiv's content will be updated with the text change.
// Base class for all track displays. Should not be instantiated on its own.
_V_.TextTrackDisplay = _V_.Component.extend({
init: function(player, options){
this._super(player, options);
player.addEvent(this.trackType + "update", _V_.proxy(this, this.update));
},
createElement: function(){
return this._super("div", {
className: "vjs-" + this.trackType
});
},
update: function(){
this.el.innerHTML = this.player.textTrackValue(this.trackType);
}
});
_V_.SubtitlesDisplay = _V_.TextTrackDisplay.extend({
trackType: "subtitles"
});
_V_.CaptionsDisplay = _V_.TextTrackDisplay.extend({
trackType: "captions"
});
_V_.ChaptersDisplay = _V_.TextTrackDisplay.extend({
trackType: "chapters"
});
_V_.DescriptionsDisplay = _V_.TextTrackDisplay.extend({
trackType: "descriptions"
});
+158
Ver Arquivo
@@ -0,0 +1,158 @@
// HTML5 Shiv. Must be in <head> to support older browsers.
document.createElement("video");document.createElement("audio");
var VideoJS = function(id, addOptions, ready){
var tag; // Element of ID
// Allow for element or ID to be passed in
// String ID
if (typeof id == "string") {
// Adjust for jQuery ID syntax
if (id.indexOf("#") === 0) {
id = id.slice(1);
}
// If a player instance has already been created for this ID return it.
if (_V_.players[id]) {
return _V_.players[id];
// Otherwise get element for ID
} else {
tag = _V_.el(id)
}
// ID is a media element
} else {
tag = id;
}
// Check for a useable element
if (!tag || !tag.nodeName) { // re: nodeName, could be a box div also
throw new TypeError("The element or ID supplied is not valid. (VideoJS)"); // Returns
}
// Element may have a player attr referring to an already created player instance.
// If not, set up a new player and return the instance.
return tag.player || new _V_.Player(tag, addOptions, ready);
},
// Shortcut
_V_ = VideoJS;
VideoJS.players = {};
VideoJS.options = {
// Default order of fallback technology
techOrder: ["html5","flash"],
// techOrder: ["flash","html5"],
html5: {},
flash: {
swf: "flash/video-js.swf"
// swf: "https://s3.amazonaws.com/video-js/3.0b/video-js.swf"
// swf: "http://video-js.zencoder.com/3.0b/video-js.swf"
// swf: "http://video-js.com/test/video-js.swf"
// swf: "http://video-js.com/source/flash/video-js.swf"
// swf: "http://video-js.com/source/flash/video-js.swf"
// swf: "video-js.swf"
},
// Default of web browser is 300x150. Should rely on source width/height.
width: "auto",
height: "auto",
// defaultVolume: 0.85,
defaultVolume: 0.00, // The freakin seaguls are driving me crazy!
// Included control sets
components: [
"poster",
"loadingSpinner",
"bigPlayButton",
{ name: "controlBar", options: {
components: [
"playToggle",
"fullscreenToggle",
"currentTimeDisplay",
"timeDivider",
"durationDisplay",
"remainingTimeDisplay",
{ name: "progressControl", options: {
components: [
{ name: "seekBar", options: {
components: [
"loadProgressBar",
"playProgressBar",
"seekHandle"
]}
}
]}
},
{ name: "volumeControl", options: {
components: [
{ name: "volumeBar", options: {
components: [
"volumeLevel",
"volumeHandle"
]}
}
]}
},
"muteToggle"
]
}},
"subtitlesDisplay"/*, "replay"*/
]
};
// Automatically set up any tags that have a data-setup attribute
_V_.autoSetup = function(){
var options, vid, player,
vids = document.getElementsByTagName("video");
// Check if any media elements exist
if (vids && vids.length > 0) {
for (var i=0,j=vids.length; i<j; i++) {
vid = vids[i];
// Check if element exists, has getAttribute func.
// IE seems to consider typeof el.getAttribute == "object" instead of "function" like expected, at least when loading the player immediately.
if (vid && vid.getAttribute) {
// Make sure this player hasn't already been set up.
if (vid.player === undefined) {
options = vid.getAttribute("data-setup");
// Check if data-setup attr exists.
// We only auto-setup if they've added the data-setup attr.
if (options !== null) {
// Parse options JSON
// If empty string, make it a parsable json object.
options = JSON.parse(options || "{}");
// Create new video.js instance.
player = _V_(vid, options);
}
}
// If getAttribute isn't defined, we need to wait for the DOM.
} else {
_V_.autoSetupTimeout(1);
break;
}
}
// No videos were found, so keep looping unless page is finisehd loading.
} else if (!_V_.windowLoaded) {
_V_.autoSetupTimeout(1);
}
};
// Pause to let the DOM keep processing
_V_.autoSetupTimeout = function(wait){
setTimeout(_V_.autoSetup, wait);
};
+217
Ver Arquivo
@@ -0,0 +1,217 @@
// ECMA-262 is the standard for javascript.
// The following methods are impelemented EXACTLY as described in the standard (according to Mozilla Docs), and do not override the default method if one exists.
// This may conflict with other libraries that modify the array prototype, but those libs should update to use the standard.
// [].indexOf
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
"use strict";
if (this === void 0 || this === null) {
throw new TypeError();
}
var t = Object(this);
var len = t.length >>> 0;
if (len === 0) {
return -1;
}
var n = 0;
if (arguments.length > 0) {
n = Number(arguments[1]);
if (n !== n) { // shortcut for verifying if it's NaN
n = 0;
} else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) {
n = (n > 0 || -1) * Math.floor(Math.abs(n));
}
}
if (n >= len) {
return -1;
}
var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
for (; k < len; k++) {
if (k in t && t[k] === searchElement) {
return k;
}
}
return -1;
}
}
// NOT NEEDED YET
// [].lastIndexOf
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf
// if (!Array.prototype.lastIndexOf)
// {
// Array.prototype.lastIndexOf = function(searchElement /*, fromIndex*/)
// {
// "use strict";
//
// if (this === void 0 || this === null)
// throw new TypeError();
//
// var t = Object(this);
// var len = t.length >>> 0;
// if (len === 0)
// return -1;
//
// var n = len;
// if (arguments.length > 1)
// {
// n = Number(arguments[1]);
// if (n !== n)
// n = 0;
// else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0))
// n = (n > 0 || -1) * Math.floor(Math.abs(n));
// }
//
// var k = n >= 0
// ? Math.min(n, len - 1)
// : len - Math.abs(n);
//
// for (; k >= 0; k--)
// {
// if (k in t && t[k] === searchElement)
// return k;
// }
// return -1;
// };
// }
// NOT NEEDED YET
// Array forEach per ECMA standard https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/foreach
// Production steps of ECMA-262, Edition 5, 15.4.4.18
// Reference: http://es5.github.com/#x15.4.4.18
// if ( !Array.prototype.forEach ) {
//
// Array.prototype.forEach = function( callback, thisArg ) {
//
// var T, k;
//
// if ( this == null ) {
// throw new TypeError( " this is null or not defined" );
// }
//
// // 1. Let O be the result of calling ToObject passing the |this| value as the argument.
// var O = Object(this);
//
// // 2. Let lenValue be the result of calling the Get internal method of O with the argument "length".
// // 3. Let len be ToUint32(lenValue).
// var len = O.length >>> 0;
//
// // 4. If IsCallable(callback) is false, throw a TypeError exception.
// // See: http://es5.github.com/#x9.11
// if ( {}.toString.call(callback) != "[object Function]" ) {
// throw new TypeError( callback + " is not a function" );
// }
//
// // 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
// if ( thisArg ) {
// T = thisArg;
// }
//
// // 6. Let k be 0
// k = 0;
//
// // 7. Repeat, while k < len
// while( k < len ) {
//
// var kValue;
//
// // a. Let Pk be ToString(k).
// // This is implicit for LHS operands of the in operator
// // b. Let kPresent be the result of calling the HasProperty internal method of O with argument Pk.
// // This step can be combined with c
// // c. If kPresent is true, then
// if ( k in O ) {
//
// // i. Let kValue be the result of calling the Get internal method of O with argument Pk.
// kValue = O[ Pk ];
//
// // ii. Call the Call internal method of callback with T as the this value and
// // argument list containing kValue, k, and O.
// callback.call( T, kValue, k, O );
// }
// // d. Increase k by 1.
// k++;
// }
// // 8. return undefined
// };
// }
// NOT NEEDED YET
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/map
// Production steps of ECMA-262, Edition 5, 15.4.4.19
// Reference: http://es5.github.com/#x15.4.4.19
// if (!Array.prototype.map) {
// Array.prototype.map = function(callback, thisArg) {
//
// var T, A, k;
//
// if (this == null) {
// throw new TypeError(" this is null or not defined");
// }
//
// // 1. Let O be the result of calling ToObject passing the |this| value as the argument.
// var O = Object(this);
//
// // 2. Let lenValue be the result of calling the Get internal method of O with the argument "length".
// // 3. Let len be ToUint32(lenValue).
// var len = O.length >>> 0;
//
// // 4. If IsCallable(callback) is false, throw a TypeError exception.
// // See: http://es5.github.com/#x9.11
// if ({}.toString.call(callback) != "[object Function]") {
// throw new TypeError(callback + " is not a function");
// }
//
// // 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
// if (thisArg) {
// T = thisArg;
// }
//
// // 6. Let A be a new array created as if by the expression new Array(len) where Array is
// // the standard built-in constructor with that name and len is the value of len.
// A = new Array(len);
//
// // 7. Let k be 0
// k = 0;
//
// // 8. Repeat, while k < len
// while(k < len) {
//
// var kValue, mappedValue;
//
// // a. Let Pk be ToString(k).
// // This is implicit for LHS operands of the in operator
// // b. Let kPresent be the result of calling the HasProperty internal method of O with argument Pk.
// // This step can be combined with c
// // c. If kPresent is true, then
// if (k in O) {
//
// // i. Let kValue be the result of calling the Get internal method of O with argument Pk.
// kValue = O[ k ];
//
// // ii. Let mappedValue be the result of calling the Call internal method of callback
// // with T as the this value and argument list containing kValue, k, and O.
// mappedValue = callback.call(T, kValue, k, O);
//
// // iii. Call the DefineOwnProperty internal method of A with arguments
// // Pk, Property Descriptor {Value: mappedValue, Writable: true, Enumerable: true, Configurable: true},
// // and false.
//
// // In browsers that support Object.defineProperty, use the following:
// // Object.defineProperty(A, Pk, { value: mappedValue, writable: true, enumerable: true, configurable: true });
//
// // For best browser support, use the following:
// A[ k ] = mappedValue;
// }
// // d. Increase k by 1.
// k++;
// }
//
// // 9. return A
// return A;
// };
// }
+295
Ver Arquivo
@@ -0,0 +1,295 @@
// Event System (J.Resig - Secrets of a JS Ninja http://jsninja.com/ [Go read it, really])
// (Book version isn't completely usable, so fixed some things and borrowed from jQuery where it's working)
//
// This should work very similarly to jQuery's events, however it's based off the book version which isn't as
// robust as jquery's, so there's probably some differences.
//
// When you add an event listener using _V_.addEvent,
// it stores the handler function in seperate cache object,
// and adds a generic handler to the element's event,
// along with a unique id (guid) to the element.
_V_.extend({
// Add an event listener to element
// It stores the handler function in a separate cache object
// and adds a generic handler to the element's event,
// along with a unique id (guid) to the element.
addEvent: function(elem, type, fn){
var data = _V_.getData(elem), handlers;
// We only need to generate one handler per element
if (data && !data.handler) {
// Our new meta-handler that fixes the event object and the context
data.handler = function(event){
event = _V_.fixEvent(event);
var handlers = _V_.getData(elem).events[event.type];
// Go through and call all the real bound handlers
if (handlers) {
// Copy handlers so if handlers are added/removed during the process it doesn't throw everything off.
var handlersCopy = [];
_V_.each(handlers, function(handler, i){
handlersCopy[i] = handler;
})
for (var i = 0, l = handlersCopy.length; i < l; i++) {
handlersCopy[i].call(elem, event);
}
}
};
}
// We need a place to store all our event data
if (!data.events) { data.events = {}; }
// And a place to store the handlers for this event type
handlers = data.events[type];
if (!handlers) {
handlers = data.events[ type ] = [];
// Attach our meta-handler to the element, since one doesn't exist
if (document.addEventListener) {
elem.addEventListener(type, data.handler, false);
} else if (document.attachEvent) {
elem.attachEvent("on" + type, data.handler);
}
}
if (!fn.guid) { fn.guid = _V_.guid++; }
handlers.push(fn);
},
removeEvent: function(elem, type, fn) {
var data = _V_.getData(elem), handlers;
// If no events exist, nothing to unbind
if (!data.events) { return; }
// Are we removing all bound events?
if (!type) {
for (type in data.events) {
_V_.cleanUpEvents(elem, type);
}
return;
}
// And a place to store the handlers for this event type
handlers = data.events[type];
// If no handlers exist, nothing to unbind
if (!handlers) { return; }
// See if we're only removing a single handler
if (fn && fn.guid) {
for (var i = 0; i < handlers.length; i++) {
// We found a match (don't stop here, there could be a couple bound)
if (handlers[i].guid === fn.guid) {
// Remove the handler from the array of handlers
handlers.splice(i--, 1);
}
}
}
_V_.cleanUpEvents(elem, type);
},
cleanUpEvents: function(elem, type) {
var data = _V_.getData(elem);
// Remove the events of a particular type if there are none left
if (data.events[type].length === 0) {
delete data.events[type];
// Remove the meta-handler from the element
if (document.removeEventListener) {
elem.removeEventListener(type, data.handler, false);
} else if (document.detachEvent) {
elem.detachEvent("on" + type, data.handler);
}
}
// Remove the events object if there are no types left
if (_V_.isEmpty(data.events)) {
delete data.events;
delete data.handler;
}
// Finally remove the expando if there is no data left
if (_V_.isEmpty(data)) {
_V_.removeData(elem);
}
},
fixEvent: function(event) {
if (event[_V_.expando]) { return event; }
// store a copy of the original event object
// and "clone" to set read-only properties
var originalEvent = event;
event = new _V_.Event(originalEvent);
for ( var i = _V_.Event.props.length, prop; i; ) {
prop = _V_.Event.props[ --i ];
event[prop] = originalEvent[prop];
}
// Fix target property, if necessary
if (!event.target) { event.target = event.srcElement || document; }
// check if target is a textnode (safari)
if (event.target.nodeType === 3) { event.target = event.target.parentNode; }
// Add relatedTarget, if necessary
if (!event.relatedTarget && event.fromElement) {
event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
}
// Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && event.clientX != null ) {
var eventDocument = event.target.ownerDocument || document,
doc = eventDocument.documentElement,
body = eventDocument.body;
event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
}
// Add which for key events
if (event.which == null && (event.charCode != null || event.keyCode != null)) {
event.which = event.charCode != null ? event.charCode : event.keyCode;
}
// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
if ( !event.metaKey && event.ctrlKey ) {
event.metaKey = event.ctrlKey;
}
// Add which for click: 1 === left; 2 === middle; 3 === right
// Note: button is not normalized, so don't use it
if ( !event.which && event.button !== undefined ) {
event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
}
return event;
},
triggerEvent: function(elem, event) {
var data = _V_.getData(elem),
parent = elem.parentNode || elem.ownerDocument,
type = event.type || event,
handler;
if (data) { handler = data.handler }
// Added in attion to book. Book code was broke.
event = typeof event === "object" ?
event[_V_.expando] ?
event :
new _V_.Event(type, event) :
new _V_.Event(type);
event.type = type;
if (handler) {
handler.call(elem, event);
}
// Clean up the event in case it is being reused
event.result = undefined;
event.target = elem;
// Bubble the event up the tree to the document,
// Unless it's been explicitly stopped
// if (parent && !event.isPropagationStopped()) {
// _V_.triggerEvent(parent, event);
//
// // We're at the top document so trigger the default action
// } else if (!parent && !event.isDefaultPrevented()) {
// // log(type);
// var targetData = _V_.getData(event.target);
// // log(targetData);
// var targetHandler = targetData.handler;
// // log("2");
// if (event.target[event.type]) {
// // Temporarily disable the bound handler,
// // don't want to execute it twice
// if (targetHandler) {
// targetData.handler = function(){};
// }
//
// // Trigger the native event (click, focus, blur)
// event.target[event.type]();
//
// // Restore the handler
// if (targetHandler) {
// targetData.handler = targetHandler;
// }
// }
// }
}
});
// Custom Event object for standardizing event objects between browsers.
_V_.Event = function(src, props){
// Event object
if (src && src.type) {
this.originalEvent = src;
this.type = src.type;
// Events bubbling up the document may have been marked as prevented
// by a handler lower down the tree; reflect the correct value.
this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false ||
src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse;
// Event type
} else {
this.type = src;
}
// Put explicitly provided properties onto the event object
if (props) { _V_.merge(this, props); }
this.timeStamp = (new Date).getTime();
// Mark it as fixed
this[_V_.expando] = true;
};
_V_.Event.prototype = {
preventDefault: function() {
this.isDefaultPrevented = returnTrue;
var e = this.originalEvent;
if (!e) { return; }
// if preventDefault exists run it on the original event
if (e.preventDefault) {
e.preventDefault();
// otherwise set the returnValue property of the original event to false (IE)
} else {
e.returnValue = false;
}
},
stopPropagation: function() {
this.isPropagationStopped = returnTrue;
var e = this.originalEvent;
if (!e) { return; }
// if stopPropagation exists run it on the original event
if (e.stopPropagation) { e.stopPropagation(); }
// otherwise set the cancelBubble property of the original event to true (IE)
e.cancelBubble = true;
},
stopImmediatePropagation: function() {
this.isImmediatePropagationStopped = returnTrue;
this.stopPropagation();
},
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse
};
_V_.Event.props = "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" ");
function returnTrue(){ return true; }
function returnFalse(){ return false; }
+54
Ver Arquivo
@@ -0,0 +1,54 @@
// Javascript JSON implementation
// (Parse Method Only)
// https://github.com/douglascrockford/JSON-js/blob/master/json2.js
var JSON;
if (!JSON) { JSON = {}; }
(function(){
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
if (typeof JSON.parse !== 'function') {
JSON.parse = function (text, reviver) {
var j;
function walk(holder, key) {
var k, v, value = holder[key];
if (value && typeof value === 'object') {
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = walk(value, k);
if (v !== undefined) {
value[k] = v;
} else {
delete value[k];
}
}
}
}
return reviver.call(holder, key, value);
}
text = String(text);
cx.lastIndex = 0;
if (cx.test(text)) {
text = text.replace(cx, function (a) {
return '\\u' +
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
});
}
if (/^[\],:{}\s]*$/
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
j = eval('(' + text + ')');
return typeof reviver === 'function' ?
walk({'': j}, '') : j;
}
throw new SyntaxError('JSON.parse');
};
}
}());
+325
Ver Arquivo
@@ -0,0 +1,325 @@
_V_.merge = function(obj1, obj2, safe){
// Make sure second object exists
if (!obj2) { obj2 = {}; };
for (var attrname in obj2){
if (obj2.hasOwnProperty(attrname) && (!safe || !obj1.hasOwnProperty(attrname))) { obj1[attrname]=obj2[attrname]; }
}
return obj1;
};
_V_.extend = function(obj){ this.merge(this, obj, true); };
_V_.extend({
tech: {}, // Holder for playback technology settings
controlSets: {}, // Holder for control set definitions
// Device Checks
isIE: function(){ return !+"\v1"; },
isIPad: function(){ return navigator.userAgent.match(/iPad/i) !== null; },
isIPhone: function(){ return navigator.userAgent.match(/iPhone/i) !== null; },
isIOS: function(){ return VideoJS.isIPhone() || VideoJS.isIPad(); },
iOSVersion: function() {
var match = navigator.userAgent.match(/OS (\d+)_/i);
if (match && match[1]) { return match[1]; }
},
isAndroid: function(){ return navigator.userAgent.match(/Android.*AppleWebKit/i) !== null; },
androidVersion: function() {
var match = navigator.userAgent.match(/Android (\d+)\./i);
if (match && match[1]) { return match[1]; }
},
testVid: document.createElement("video"),
ua: navigator.userAgent,
support: {},
each: function(arr, fn){
if (!arr || arr.length === 0) { return; }
for (var i=0,j=arr.length; i<j; i++) {
fn.call(this, arr[i], i);
}
},
el: function(id){ return document.getElementById(id); },
createElement: function(tagName, attributes){
var el = document.createElement(tagName),
attrname;
for (attrname in attributes){
if (attributes.hasOwnProperty(attrname)) {
if (attrname.indexOf("-") !== -1) {
el.setAttribute(attrname, attributes[attrname]);
} else {
el[attrname] = attributes[attrname];
}
}
}
return el;
},
insertFirst: function(node, parent){
if (parent.firstChild) {
parent.insertBefore(node, parent.firstChild);
} else {
parent.appendChild(node);
}
},
addClass: function(element, classToAdd){
if ((" "+element.className+" ").indexOf(" "+classToAdd+" ") == -1) {
element.className = element.className === "" ? classToAdd : element.className + " " + classToAdd;
}
},
removeClass: function(element, classToRemove){
if (element.className.indexOf(classToRemove) == -1) { return; }
var classNames = element.className.split(" ");
classNames.splice(classNames.indexOf(classToRemove),1);
element.className = classNames.join(" ");
},
remove: function(item, array){
if (!array) return;
var i = array.indexOf(item);
if (i != -1) {
return array.splice(i, 1)
};
},
// Attempt to block the ability to select text while dragging controls
blockTextSelection: function(){
document.body.focus();
document.onselectstart = function () { return false; };
},
// Turn off text selection blocking
unblockTextSelection: function(){ document.onselectstart = function () { return true; }; },
// Return seconds as H:MM:SS or M:SS
// Supplying a guide (in seconds) will include enough leading zeros to cover the length of the guide
formatTime: function(seconds, guide) {
var guide = guide || seconds, // Default to using seconds as guide
s = Math.floor(seconds % 60),
m = Math.floor(seconds / 60 % 60),
h = Math.floor(seconds / 3600),
gm = Math.floor(guide / 60 % 60),
gh = Math.floor(guide / 3600);
// Check if we need to show hours
h = (h > 0 || gh > 0) ? h + ":" : "";
// If hours are showing, we may need to add a leading zero.
// Always show at least one digit of minutes.
m = (((h || gm >= 10) && m < 10) ? "0" + m : m) + ":";
// Check if leading zero is need for seconds
s = (s < 10) ? "0" + s : s;
return h + m + s;
},
capitalize: function(string){
return string.charAt(0).toUpperCase() + string.slice(1);
},
// Return the relative horizonal position of an event as a value from 0-1
getRelativePosition: function(x, relativeElement){
return Math.max(0, Math.min(1, (x - _V_.findPosX(relativeElement)) / relativeElement.offsetWidth));
},
getComputedStyleValue: function(element, style){
return window.getComputedStyle(element, null).getPropertyValue(style);
},
trim: function(string){ return string.toString().replace(/^\s+/, "").replace(/\s+$/, ""); },
round: function(num, dec) {
if (!dec) { dec = 0; }
return Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
},
isEmpty: function(object) {
for (var prop in object) {
return false;
}
return true;
},
// Mimic HTML5 TimeRange Spec.
createTimeRange: function(start, end){
return {
length: 1,
start: function() { return start; },
end: function() { return end; }
};
},
/* Element Data Store. Allows for binding data to an element without putting it directly on the element.
Ex. Event listneres are stored here.
(also from jsninja.com)
================================================================================ */
cache: {}, // Where the data is stored
guid: 1, // Unique ID for the element
expando: "vdata" + (new Date).getTime(), // Unique attribute to store element's guid in
// Returns the cache object where data for the element is stored
getData: function(elem){
var id = elem[_V_.expando];
if (!id) {
id = elem[_V_.expando] = _V_.guid++;
_V_.cache[id] = {};
}
return _V_.cache[id];
},
// Delete data for the element from the cache and the guid attr from element
removeData: function(elem){
var id = elem[_V_.expando];
if (!id) { return; }
// Remove all stored data
delete _V_.cache[id];
// Remove the expando property from the DOM node
try {
delete elem[_V_.expando];
} catch(e) {
if (elem.removeAttribute) {
elem.removeAttribute(_V_.expando);
} else {
// IE doesn't appear to support removeAttribute on the document element
elem[_V_.expando] = null;
}
}
},
/* Proxy (a.k.a Bind or Context). A simple method for changing the context of a function
It also stores a unique id on the function so it can be easily removed from events
================================================================================ */
proxy: function(context, fn) {
// Make sure the function has a unique ID
if (!fn.guid) { fn.guid = _V_.guid++; }
// Create the new function that changes the context
var ret = function() {
return fn.apply(context, arguments);
};
// Give the new function the same ID
// (so that they are equivalent and can be easily removed)
ret.guid = fn.guid;
return ret;
},
get: function(url, onSuccess, onError){
// if (netscape.security.PrivilegeManager.enablePrivilege) {
// netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
// }
var local = (url.indexOf("file:") == 0 || (window.location.href.indexOf("file:") == 0 && url.indexOf("http:") == -1));
if (typeof XMLHttpRequest == "undefined") {
XMLHttpRequest = function () {
try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch (e) {}
try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch (f) {}
try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (g) {}
throw new Error("This browser does not support XMLHttpRequest.");
};
}
var request = new XMLHttpRequest();
try {
request.open("GET", url);
} catch(e) {
_V_.log("VideoJS XMLHttpRequest (open)", e);
// onError(e);
return false;
}
request.onreadystatechange = _V_.proxy(this, function() {
if (request.readyState == 4) {
if (request.status == 200 || local && request.status == 0) {
onSuccess(request.responseText);
} else {
if (onError) {
onError();
}
}
}
});
try {
request.send();
} catch(e) {
_V_.log("VideoJS XMLHttpRequest (send)", e);
if (onError) {
onError(e);
}
}
},
/* Local Storage
================================================================================ */
setLocalStorage: function(key, value){
// IE was throwing errors referencing the var anywhere without this
var localStorage = localStorage || false;
if (!localStorage) { return; }
try {
localStorage[key] = value;
} catch(e) {
if (e.code == 22 || e.code == 1014) { // Webkit == 22 / Firefox == 1014
_V_.log("LocalStorage Full (VideoJS)", e);
} else {
_V_.log("LocalStorage Error (VideoJS)", e);
}
}
}
});
// usage: log('inside coolFunc', this, arguments);
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
_V_.log = function(){
_V_.log.history = _V_.log.history || [];// store logs to an array for reference
_V_.log.history.push(arguments);
if(window.console) {
arguments.callee = arguments.callee.caller;
var newarr = [].slice.call(arguments);
(typeof console.log === 'object' ? _V_.log.apply.call(console.log, console, newarr) : console.log.apply(console, newarr));
}
};
// make it safe to use console.log always
(function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,timeStamp,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();){b[a]=b[a]||c}})((function(){try
{console.log();return window.console;}catch(err){return window.console={};}})());
// Offset Left
// getBoundingClientRect technique from John Resig http://ejohn.org/blog/getboundingclientrect-is-awesome/
if ("getBoundingClientRect" in document.documentElement) {
_V_.findPosX = function(el) {
var box;
try {
box = el.getBoundingClientRect();
} catch(e) {}
if (!box) { return 0; }
var docEl = document.documentElement,
body = document.body,
clientLeft = docEl.clientLeft || body.clientLeft || 0,
scrollLeft = window.pageXOffset || body.scrollLeft,
left = box.left + scrollLeft - clientLeft;
return left;
};
} else {
_V_.findPosX = function(el) {
var curleft = el.offsetLeft;
// _V_.log(obj.className, obj.offsetLeft)
while(el = obj.offsetParent) {
if (el.className.indexOf("video-js") == -1) {
// _V_.log(el.offsetParent, "OFFSETLEFT", el.offsetLeft)
// _V_.log("-webkit-full-screen", el.webkitMatchesSelector("-webkit-full-screen"));
// _V_.log("-webkit-full-screen", el.querySelectorAll(".video-js:-webkit-full-screen"));
} else {
}
curleft += el.offsetLeft;
}
return curleft;
};
}
+764
Ver Arquivo
@@ -0,0 +1,764 @@
/* UI Component- Base class for all UI objects
================================================================================ */
_V_.Player = _V_.Component.extend({
init: function(tag, addOptions, ready){
this.tag = tag; // Store the original tag used to set options
var el = this.el = _V_.createElement("div"), // Div to contain video and controls
options = this.options = {},
width = options.width = tag.width,
height = options.height = tag.height,
// Browsers default to 300x150 if there's no width/height or video size data.
initWidth = width || 300,
initHeight = height || 150;
// Make player findable on elements
tag.player = el.player = this;
// Add callback to ready queue
this.ready(ready);
// Wrap video tag in div (el/box) container
tag.parentNode.insertBefore(el, tag);
el.appendChild(tag); // Breaks iPhone, fixed in HTML5 setup.
// Give video tag properties to box
el.id = this.id = tag.id; // ID will now reference box, not the video tag
el.className = tag.className;
// Update tag id/class for use as HTML5 playback tech
tag.id += "_html5_api";
tag.className = "vjs-tech";
// Make player easily findable by ID
_V_.players[el.id] = this;
// Make box use width/height of tag, or default 300x150
el.setAttribute("width", initWidth);
el.setAttribute("height", initHeight);
// Enforce with CSS since width/height attrs don't work on divs
el.style.width = initWidth+"px";
el.style.height = initHeight+"px";
// Remove width/height attrs from tag so CSS can make it 100% width/height
tag.removeAttribute("width");
tag.removeAttribute("height");
// Set Options
_V_.merge(options, _V_.options); // Copy Global Defaults
_V_.merge(options, this.getVideoTagSettings()); // Override with Video Tag Options
_V_.merge(options, addOptions); // Override/extend with options from setup call
// Store controls setting, and then remove immediately so native controls don't flash.
tag.removeAttribute("controls");
// Poster will be handled by a manual <img>
tag.removeAttribute("poster");
// Empty video tag sources and tracks so the built in player doesn't use them also.
if (tag.hasChildNodes()) {
for (var i=0,j=tag.childNodes;i<j.length;i++) {
if (j[i].nodeName == "SOURCE" || j[i].nodeName == "TRACK") {
tag.removeChild(j[i]);
}
}
}
// Holder for playback tech components
this.techs = {};
// Cache for video property values.
this.values = {};
this.addClass("vjs-paused");
this.addEvent("ended", this.onEnded);
this.addEvent("play", this.onPlay);
this.addEvent("pause", this.onPause);
this.addEvent("error", this.onError);
// When the API is ready, loop through the components and add to the player.
if (options.controls) {
this.ready(function(){
this.each(this.options.components, function(set){
this.addComponent(set);
});
});
}
// If there are no sources when the player is initialized,
// load the first supported playback technology.
if (!options.sources || options.sources.length == 0) {
for (var i=0,j=options.techOrder; i<j.length; i++) {
var techName = j[i],
tech = _V_[techName];
// Check if the browser supports this technology
if (tech.isSupported()) {
this.loadTech(techName);
break;
}
}
} else {
// Loop through playback technologies (HTML5, Flash) and check for support
// Then load the best source.
this.src(options.sources);
}
},
// Cache for video property values.
values: {},
destroy: function(){
// Ensure that tracking progress and time progress will stop and plater deleted
this.stopTrackingProgress();
this.stopTrackingCurrentTime();
delete _V_.players[this.id]
},
createElement: function(type, options){
},
getVideoTagSettings: function(){
var options = {
sources: [],
tracks: []
};
options.src = this.tag.src;
options.controls = this.tag.getAttribute("controls") !== null;
options.poster = this.tag.poster;
options.preload = this.tag.preload;
options.autoplay = this.tag.getAttribute("autoplay") !== null; // hasAttribute not IE <8 compatible
options.loop = this.tag.getAttribute("loop") !== null;
options.muted = this.tag.getAttribute("muted") !== null;
for (var c,i=0,j=this.tag.children;i<j.length;i++) {
c = j[i];
if (c.nodeName == "SOURCE") {
options.sources.push({
src: c.src,
type: c.type,
media: c.media,
title: c.title
});
}
if (c.nodeName == "TRACK") {
options.tracks.push(new _V_.Track({
src: c.getAttribute("src"),
kind: c.getAttribute("kind"),
srclang: c.getAttribute("srclang"),
label: c.getAttribute("label"),
'default': c.getAttribute("default") !== null,
title: c.getAttribute("title")
}, this));
}
}
return options;
},
/* PLayback Technology (tech)
================================================================================ */
// Load/Create an instance of playback technlogy including element and API methods
// And append playback element in player div.
loadTech: function(techName, source){
// Pause and remove current playback technology
if (this.tech) {
this.unloadTech();
// If the first time loading, HTML5 tag will exist but won't be initialized
// So we need to remove it if we're not loading HTML5
} else if (techName != "html5" && this.tag) {
this.el.removeChild(this.tag);
this.tag = false;
}
this.techName = techName;
// Turn off API access because we're loading a new tech that might load asynchronously
this.isReady = false;
var techReady = function(){
this.player.triggerReady();
// Manually track progress in cases where the browser/flash player doesn't report it.
if (!this.support.progressEvent) {
this.player.manualProgressOn();
}
// Manually track timeudpates in cases where the browser/flash player doesn't report it.
if (!this.support.timeupdateEvent) {
this.player.manualTimeUpdatesOn();
}
}
// Grab tech-specific options from player options and add source and parent element to use.
var techOptions = _V_.merge({ source: source, parentEl: this.el }, this.options[techName])
if (source.src == this.values.src && this.values.currentTime > 0) {
techOptions.startTime = this.values.currentTime;
}
if (source) {
this.values.src = source.src;
}
// Initialize tech instance
this.tech = new _V_[techName](this, techOptions);
this.tech.ready(techReady);
},
unloadTech: function(){
this.tech.destroy();
// Turn off any manual progress or timeupdate tracking
if (this.manualProgress) { this.manualProgressOff(); }
if (this.manualTimeUpdates) { this.manualTimeUpdatesOff(); }
this.tech = false;
},
// There's many issues around changing the size of a Flash (or other plugin) object.
// First is a plugin reload issue in Firefox that has been around for 11 years: https://bugzilla.mozilla.org/show_bug.cgi?id=90268
// Then with the new fullscreen API, Mozilla and webkit browsers will reload the flash object after going to fullscreen.
// To get around this, we're unloading the tech, caching source and currentTime values, and reloading the tech once the plugin is resized.
reloadTech: function(betweenFn){
_V_.log("unloadingTech")
this.unloadTech();
_V_.log("unloadedTech")
if (betweenFn) { betweenFn.call(); }
_V_.log("LoadingTech")
this.loadTech(this.techName, { src: this.values.src })
_V_.log("loadedTech")
},
/* Fallbacks for unsupported event types
================================================================================ */
// Manually trigger progress events based on changes to the buffered amount
// Many flash players and older HTML5 browsers don't send progress or progress-like events
manualProgressOn: function(){
this.manualProgress = true;
// Trigger progress watching when a source begins loading
this.trackProgress();
// Watch for a native progress event call on the tech element
// In HTML5, some older versions don't support the progress event
// So we're assuming they don't, and turning off manual progress if they do.
this.tech.addEvent("progress", function(){
// Remove this listener from the element
this.removeEvent("progress", arguments.callee);
// Update known progress support for this playback technology
this.support.progressEvent = true;
// Turn off manual progress tracking
this.player.manualProgressOff();
});
},
manualProgressOff: function(){
this.manualProgress = false;
this.stopTrackingProgress();
},
trackProgress: function(){
this.progressInterval = setInterval(_V_.proxy(this, function(){
// Don't trigger unless buffered amount is greater than last time
// log(this.values.bufferEnd, this.buffered().end(0), this.duration())
/* TODO: update for multiple buffered regions */
if (this.values.bufferEnd < this.buffered().end(0)) {
this.triggerEvent("progress");
} else if (this.bufferedPercent() == 1) {
this.stopTrackingProgress();
this.triggerEvent("progress"); // Last update
}
}), 500);
},
stopTrackingProgress: function(){ clearInterval(this.progressInterval); },
/* Time Tracking -------------------------------------------------------------- */
manualTimeUpdatesOn: function(){
this.manualTimeUpdates = true;
this.addEvent("play", this.trackCurrentTime);
this.addEvent("pause", this.stopTrackingCurrentTime);
// timeupdate is also called by .currentTime whenever current time is set
// Watch for native timeupdate event
this.tech.addEvent("timeupdate", function(){
// Remove this listener from the element
this.removeEvent("timeupdate", arguments.callee);
// Update known progress support for this playback technology
this.support.timeupdateEvent = true;
// Turn off manual progress tracking
this.player.manualTimeUpdatesOff();
});
},
manualTimeUpdatesOff: function(){
this.manualTimeUpdates = false;
this.stopTrackingCurrentTime();
this.removeEvent("play", this.trackCurrentTime);
this.removeEvent("pause", this.stopTrackingCurrentTime);
},
trackCurrentTime: function(){
if (this.currentTimeInterval) { this.stopTrackingCurrentTime(); }
this.currentTimeInterval = setInterval(_V_.proxy(this, function(){
this.triggerEvent("timeupdate");
}), 250); // 42 = 24 fps // 250 is what Webkit uses // FF uses 15
},
// Turn off play progress tracking (when paused or dragging)
stopTrackingCurrentTime: function(){ clearInterval(this.currentTimeInterval); },
/* Player event handlers (how the player reacts to certain events)
================================================================================ */
onEnded: function(){
if (this.options.loop) {
this.currentTime(0);
this.play();
} else {
this.pause();
this.currentTime(0);
this.pause();
}
},
onPlay: function(){
_V_.removeClass(this.el, "vjs-paused");
_V_.addClass(this.el, "vjs-playing");
},
onPause: function(){
_V_.removeClass(this.el, "vjs-playing");
_V_.addClass(this.el, "vjs-paused");
},
onError: function(e) {
_V_.log("Video Error", e);
},
/* Player API
================================================================================ */
apiCall: function(method, arg){
if (this.isReady) {
return this.tech[method](arg);
} else {
_V_.log("The playback technology API is not ready yet. Use player.ready(myFunction)."+" ["+method+"]", arguments.callee.caller.arguments.callee.caller.arguments.callee.caller)
return false;
// throw new Error("The playback technology API is not ready yet. Use player.ready(myFunction)."+" ["+method+"]");
}
},
play: function(){
this.apiCall("play"); return this;
},
pause: function(){
this.apiCall("pause"); return this;
},
paused: function(){
return this.apiCall("paused");
},
currentTime: function(seconds){
if (seconds !== undefined) {
// Cache the last set value for smoother scrubbing.
this.values.lastSetCurrentTime = seconds;
this.apiCall("setCurrentTime", seconds);
if (this.manualTimeUpdates) {
this.triggerEvent("timeupdate");
}
return this;
}
// Cache last currentTime and return
return this.values.currentTime = this.apiCall("currentTime");
},
duration: function(){
return this.apiCall("duration");
},
remainingTime: function(){
return this.duration() - this.currentTime();
},
buffered: function(){
var buffered = this.apiCall("buffered"),
start = 0, end = this.values.bufferEnd = this.values.bufferEnd || 0,
timeRange;
if (buffered && buffered.length > 0 && buffered.end(0) !== end) {
end = buffered.end(0);
// Storing values allows them be overridden by setBufferedFromProgress
this.values.bufferEnd = end;
}
return _V_.createTimeRange(start, end);
},
// Calculates amount of buffer is full
bufferedPercent: function(){
return (this.duration()) ? this.buffered().end(0) / this.duration() : 0;
},
volume: function(percentAsDecimal){
if (percentAsDecimal !== undefined) {
var vol = Math.max(0, Math.min(1, parseFloat(percentAsDecimal))); // Force value to between 0 and 1
this.values.volume = vol;
this.apiCall("setVolume", vol);
_V_.setLocalStorage("volume", vol);
return this;
}
// if (this.values.volume) { return this.values.volume; }
return this.apiCall("volume");
},
muted: function(muted){
if (muted !== undefined) {
this.apiCall("setMuted", muted);
return this;
}
return this.apiCall("muted");
},
width: function(width, skipListeners){
if (width !== undefined) {
this.el.width = width;
this.el.style.width = width+"px";
if (!skipListeners) { this.triggerEvent("resize"); }
return this;
}
return parseInt(this.el.getAttribute("width"));
},
height: function(height){
if (height !== undefined) {
this.el.height = height;
this.el.style.height = height+"px";
this.triggerEvent("resize");
return this;
}
return parseInt(this.el.getAttribute("height"));
},
size: function(width, height){
// Skip resize listeners on width for optimization
return this.width(width, true).height(height);
},
supportsFullScreen: function(){ return this.apiCall("supportsFullScreen"); },
// Turn on fullscreen (or window) mode
requestFullScreen: function(){
var requestFullScreen = _V_.support.requestFullScreen;
// Check for browser element fullscreen support
if (requestFullScreen) {
// Flash and other plugins get reloaded when you take their parent to fullscreen.
// To fix that we'll remove the tech, and reload it after the resize has finished.
if (this.tech.support.fullscreenResize === false) {
this.pause();
this.unloadTech();
_V_.addEvent(document, "keydown", _V_.proxy(this, function(e){
_V_.log("asdf", e)
}));
_V_.addEvent(document, requestFullScreen.eventName, this.proxy(function(){
_V_.removeEvent(document, requestFullScreen.eventName, arguments.callee);
this.loadTech(this.techName, { src: this.values.src });
}));
this.el[requestFullScreen.requestFn]();
} else {
this.el[requestFullScreen.requestFn]();
}
} else if (this.tech.supportsFullScreen()) {
this.apiCall("enterFullScreen");
} else {
this.enterFullWindow();
}
this.videoIsFullScreen = true;
this.triggerEvent("fullscreenchange");
return this;
},
cancelFullScreen: function(){
var requestFullScreen = _V_.support.requestFullScreen;
// Check for browser element fullscreen support
if (requestFullScreen) {
// Flash and other plugins get reloaded when you take their parent to fullscreen.
// To fix that we'll remove the tech, and reload it after the resize has finished.
if (this.tech.support.fullscreenResize === false) {
this.pause();
this.unloadTech();
_V_.addEvent(document, requestFullScreen.eventName, this.proxy(function(){
_V_.removeEvent(document, requestFullScreen.eventName, arguments.callee);
_V_.log("document fullscreeneventchange")
this.loadTech(this.techName, { src: this.values.src })
}));
document[requestFullScreen.cancelFn]();
} else {
document[requestFullScreen.cancelFn]();
}
} else if (this.tech.supportsFullScreen()) {
this.apiCall("exitFullScreen");
} else {
this.exitFullWindow();
}
this.videoIsFullScreen = false;
this.triggerEvent("fullscreenchange");
return this;
},
enterFullWindow: function(){
this.videoIsFullScreen = true;
// Storing original doc overflow value to return to when fullscreen is off
this.docOrigOverflow = document.documentElement.style.overflow;
// Add listener for esc key to exit fullscreen
_V_.addEvent(document, "keydown", _V_.proxy(this, this.fullWindowOnEscKey));
// Hide any scroll bars
document.documentElement.style.overflow = 'hidden';
// Apply fullscreen styles
_V_.addClass(document.body, "vjs-full-window");
_V_.addClass(this.el, "vjs-fullscreen");
this.triggerEvent("enterFullWindow");
},
fullWindowOnEscKey: function(event){
if (event.keyCode == 27) {
this.cancelFullScreen();
}
},
exitFullWindow: function(){
this.videoIsFullScreen = false;
_V_.removeEvent(document, "keydown", this.fullWindowOnEscKey);
// Unhide scroll bars.
document.documentElement.style.overflow = this.docOrigOverflow;
// Remove fullscreen styles
_V_.removeClass(document.body, "vjs-full-window");
_V_.removeClass(this.el, "vjs-fullscreen");
// Resize the box, controller, and poster to original sizes
// this.positionAll();
this.triggerEvent("exitFullWindow");
},
// src is a pretty powerful function
// If you pass it an array of source objects, it will find the best source to play and use that object.src
// If the new source requires a new playback technology, it will switch to that.
// If you pass it an object, it will set the source to object.src
// If you pass it anything else (url string) it will set the video source to that
src: function(source){
// Case: Array of source objects to choose from and pick the best to play
if (source instanceof Array) {
var sources = source;
techLoop: // Named loop for breaking both loops
// Loop through each playback technology in the options order
for (var i=0,j=this.options.techOrder;i<j.length;i++) {
var techName = j[i],
tech = _V_[techName];
// tech = _V_.tech[techName];
// Check if the browser supports this technology
if (tech.isSupported()) {
// Loop through each source object
for (var a=0,b=sources;a<b.length;a++) {
var source = b[a];
// Check if source can be played with this technology
if (tech.canPlaySource.call(this, source)) {
// If this technology is already loaded, set source
if (techName == this.currentTechName) {
this.src(source); // Passing the source object
// Otherwise load this technology with chosen source
} else {
this.loadTech(techName, source);
}
break techLoop; // Break both loops
}
}
}
}
// Case: Source object { src: "", type: "" ... }
} else if (source instanceof Object) {
if (_V_[this.techName].canPlaySource(source)) {
this.src(source.src);
} else {
// Send through tech loop to check for a compatible technology.
this.src([source]);
}
// Case: URL String (http://myvideo...)
} else {
// Cache for getting last set source
this.values.src = source;
if (!this.isReady) {
this.ready(function(){
this.src(source);
});
} else {
this.apiCall("src", source);
if (this.options.preload == "auto") {
this.load();
}
if (this.options.autoplay) {
this.play();
}
}
}
return this;
},
// Begin loading the src data
load: function(){
this.apiCall("load");
return this;
},
currentSrc: function(){
return this.apiCall("currentSrc");
},
textTrackValue: function(kind, value){
if (value !== undefined) {
this.values[kind] = value;
this.triggerEvent(kind+"update");
return this;
}
return this.values[kind];
},
// Attributes/Options
preload: function(value){
if (value !== undefined) {
this.apiCall("setPreload", value);
this.options.preload = value;
return this;
}
return this.apiCall("preload", value);
},
autoplay: function(value){
if (value !== undefined) {
this.apiCall("setAutoplay", value);
this.options.autoplay = value;
return this;
}
return this.apiCall("autoplay", value);
},
loop: function(value){
if (value !== undefined) {
this.apiCall("setLoop", value);
this.options.loop = value;
return this;
}
return this.apiCall("loop", value);
},
controls: function(){ return this.options.controls; },
textTracks: function(){ return this.options.tracks; },
poster: function(){ return this.apiCall("poster"); },
error: function(){ return this.apiCall("error"); },
networkState: function(){ return this.apiCall("networkState"); },
readyState: function(){ return this.apiCall("readyState"); },
seeking: function(){ return this.apiCall("seeking"); },
initialTime: function(){ return this.apiCall("initialTime"); },
startOffsetTime: function(){ return this.apiCall("startOffsetTime"); },
played: function(){ return this.apiCall("played"); },
seekable: function(){ return this.apiCall("seekable"); },
ended: function(){ return this.apiCall("ended"); },
videoTracks: function(){ return this.apiCall("videoTracks"); },
audioTracks: function(){ return this.apiCall("audioTracks"); },
videoWidth: function(){ return this.apiCall("videoWidth"); },
videoHeight: function(){ return this.apiCall("videoHeight"); },
defaultPlaybackRate: function(){ return this.apiCall("defaultPlaybackRate"); },
playbackRate: function(){ return this.apiCall("playbackRate"); },
// mediaGroup: function(){ return this.apiCall("mediaGroup"); },
// controller: function(){ return this.apiCall("controller"); },
controls: function(){ return this.apiCall("controls"); },
defaultMuted: function(){ return this.apiCall("defaultMuted"); }
});
// RequestFullscreen API
(function(){
var requestFn,
cancelFn,
playerProto = _V_.Player.prototype;
// Current W3C Spec
// http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#api
// Mozilla Draft: https://wiki.mozilla.org/Gecko:FullScreenAPI#fullscreenchange_event
if (document.cancelFullscreen !== undefined) {
requestFn = "requestFullscreen";
cancelFn = "exitFullscreen";
eventName = "fullscreenchange";
// Webkit (Chrome/Safari) and Mozilla (Firefox) have working implementaitons
// that use prefixes and vary slightly from the new W3C spec. Specifically, using 'exit' instead of 'cancel',
// and lowercasing the 'S' in Fullscreen.
// Other browsers don't have any hints of which version they might follow yet, so not going to try to predict by loopeing through all prefixes.
} else {
_V_.each(["moz", "webkit"], function(prefix){
if (document[prefix + "CancelFullScreen"] !== undefined) {
requestFn = prefix + "RequestFullScreen";
cancelFn = prefix + "CancelFullScreen";
eventName = prefix + "fullscreenchange";
}
});
}
if (requestFn) {
_V_.support.requestFullScreen = {
requestFn: requestFn,
cancelFn: cancelFn,
eventName: eventName
};
}
})();
+4
Ver Arquivo
@@ -0,0 +1,4 @@
_V_.addEvent(window, "load", function(){
_V_.windowLoaded = true;
});
_V_.autoSetupTimeout();
+453
Ver Arquivo
@@ -0,0 +1,453 @@
/* Playback Technology - Base class for playback technologies
================================================================================ */
_V_.PlaybackTech = _V_.Component.extend({
init: function(player, options){
// this._super(player, options);
// Make playback element clickable
// _V_.addEvent(this.el, "click", _V_.proxy(this, _V_.PlayToggle.prototype.onClick));
// this.addEvent("click", this.proxy(this.onClick));
// player.triggerEvent("techready");
},
// destroy: function(){},
// createElement: function(){},
onClick: function(){
if (this.player.options.controls) {
_V_.PlayToggle.prototype.onClick.call(this);
}
}
});
// Create placeholder methods for each that warn when a method isn't supported by the current playback technology
_V_.apiMethods = "play,pause,paused,currentTime,setCurrentTime,duration,buffered,volume,setVolume,muted,setMuted,width,height,supportsFullScreen,enterFullScreen,src,load,currentSrc,preload,setPreload,autoplay,setAutoplay,loop,setLoop,error,networkState,readyState,seeking,initialTime,startOffsetTime,played,seekable,ended,videoTracks,audioTracks,videoWidth,videoHeight,textTracks,defaultPlaybackRate,playbackRate,mediaGroup,controller,controls,defaultMuted".split(",");
_V_.each(_V_.apiMethods, function(methodName){
_V_.PlaybackTech.prototype[methodName] = function(){
throw new Error("The '"+method+"' method is not available on the playback technology's API");
}
});
/* HTML5 Playback Technology - Wrapper for HTML5 Media API
================================================================================ */
_V_.html5 = _V_.PlaybackTech.extend({
init: function(player, options, ready){
this.player = player;
this.el = this.createElement();
this.ready(ready);
this.addEvent("click", this.proxy(this.onClick));
var source = options.source;
// If the element source is already set, we may have missed the loadstart event, and want to trigger it.
// We don't want to set the source again and interrupt playback.
if (source && this.el.currentSrc == source.src) {
player.triggerEvent("loadstart");
// Otherwise set the source if one was provided.
} else if (source) {
this.el.src = source.src;
}
// Chrome and Safari both have issues with autoplay.
// In Safari (5.1.1), when we move the video element into the container div, autoplay doesn't work.
// In Chrome (15), if you have autoplay + a poster + no controls, the video gets hidden (but audio plays)
// This fixes both issues. Need to wait for API, so it updates displays correctly
player.ready(function(){
if (this.options.autoplay && this.paused()) {
this.tag.poster = null; // Chrome Fix. Fixed in Chrome v16.
this.play();
}
});
this.setupTriggers();
this.triggerReady();
},
destroy: function(){
this.player.tag = false;
this.removeTriggers();
this.el.parentNode.removeChild(this.el);
},
createElement: function(){
var html5 = _V_.html5,
player = this.player,
// If possible, reuse original tag for HTML5 playback technology element
el = player.tag,
newEl;
// Check if this browser supports moving the element into the box.
// On the iPhone video will break if you move the element,
// So we have to create a brand new element.
if (!el || this.support.movingElementInDOM === false) {
// If the original tag is still there, remove it.
if (el) {
player.el.removeChild(el);
}
newEl = _V_.createElement("video", {
id: el.id || player.el.id + "_html5_api",
className: el.className || "vjs-tech"
});
el = newEl;
_V_.insertFirst(el, player.el);
}
// Update tag settings, in case they were overridden
_V_.each(["autoplay","preload","loop","muted"], function(attr){ // ,"poster"
el[attr] = player.options[attr];
}, this);
return el;
},
// Make video events trigger player events
// May seem verbose here, but makes other APIs possible.
setupTriggers: function(){
_V_.each.call(this, _V_.html5.events, function(type){
_V_.addEvent(this.el, type, _V_.proxy(this.player, this.eventHandler));
});
},
removeTriggers: function(){
_V_.each.call(this, _V_.html5.events, function(type){
_V_.removeEvent(this.el, type, _V_.proxy(this.player, this.eventHandler));
});
},
eventHandler: function(e){
e.stopPropagation();
this.triggerEvent(e);
},
play: function(){ this.el.play(); },
pause: function(){ this.el.pause(); },
paused: function(){ return this.el.paused; },
currentTime: function(){ return this.el.currentTime; },
setCurrentTime: function(seconds){
try {
this.el.currentTime = seconds;
} catch(e) {
_V_.log(e, "Video isn't ready. (VideoJS)");
// this.warning(VideoJS.warnings.videoNotReady);
}
},
duration: function(){ return this.el.duration || 0; },
buffered: function(){ return this.el.buffered; },
volume: function(){ return this.el.volume; },
setVolume: function(percentAsDecimal){ this.el.volume = percentAsDecimal; },
muted: function(){ return this.el.muted; },
setMuted: function(muted){ this.el.muted = muted },
width: function(){ return this.el.offsetWidth; },
height: function(){ return this.el.offsetHeight; },
supportsFullScreen: function(){
if (typeof this.el.webkitEnterFullScreen == 'function') {
// Seems to be broken in Chromium/Chrome && Safari in Leopard
if (!navigator.userAgent.match("Chrome") && !navigator.userAgent.match("Mac OS X 10.5")) {
return true;
}
}
return false;
},
enterFullScreen: function(){
try {
this.el.webkitEnterFullScreen();
} catch (e) {
if (e.code == 11) {
// this.warning(VideoJS.warnings.videoNotReady);
_V_.log("VideoJS: Video not ready.")
}
}
},
src: function(src){ this.el.src = src; },
load: function(){ this.el.load(); },
currentSrc: function(){ return this.el.currentSrc; },
preload: function(){ return this.el.preload; },
setPreload: function(val){ this.el.preload = val; },
autoplay: function(){ return this.el.autoplay; },
setAutoplay: function(val){ this.el.autoplay = val; },
loop: function(){ return this.el.loop; },
setLoop: function(val){ this.el.loop = val; },
error: function(){ return this.el.error; },
networkState: function(){ return this.el.networkState; },
readyState: function(){ return this.el.readyState; },
seeking: function(){ return this.el.seeking; },
initialTime: function(){ return this.el.initialTime; },
startOffsetTime: function(){ return this.el.startOffsetTime; },
played: function(){ return this.el.played; },
seekable: function(){ return this.el.seekable; },
ended: function(){ return this.el.ended; },
videoTracks: function(){ return this.el.videoTracks; },
audioTracks: function(){ return this.el.audioTracks; },
videoWidth: function(){ return this.el.videoWidth; },
videoHeight: function(){ return this.el.videoHeight; },
textTracks: function(){ return this.el.textTracks; },
defaultPlaybackRate: function(){ return this.el.defaultPlaybackRate; },
playbackRate: function(){ return this.el.playbackRate; },
mediaGroup: function(){ return this.el.mediaGroup; },
controller: function(){ return this.el.controller; },
controls: function(){ return this.player.options.controls; },
defaultMuted: function(){ return this.el.defaultMuted; }
});
/* HTML5 Support Testing -------------------------------------------------------- */
_V_.html5.isSupported = function(){
return !!document.createElement("video").canPlayType;
};
_V_.html5.canPlaySource = function(srcObj){
return !!document.createElement("video").canPlayType(srcObj.type);
// TODO: Check Type
// If no Type, check ext
// Check Media Type
};
// List of all HTML5 events (various uses).
_V_.html5.events = "loadstart,suspend,abort,error,emptied,stalled,loadedmetadata,loadeddata,canplay,canplaythrough,playing,waiting,seeking,seeked,ended,durationchange,timeupdate,progress,play,pause,ratechange,volumechange".split(",");
/* HTML5 Device Fixes ---------------------------------------------------------- */
_V_.html5.prototype.support = {
// Support for tech specific full screen. (webkitEnterFullScreen, not requestFullscreen)
// http://developer.apple.com/library/safari/#documentation/AudioVideo/Reference/HTMLVideoElementClassReference/HTMLVideoElement/HTMLVideoElement.html
// Seems to be broken in Chromium/Chrome && Safari in Leopard
fullscreen: (typeof _V_.testVid.webkitEnterFullScreen !== undefined) ? (!_V_.ua.match("Chrome") && !_V_.ua.match("Mac OS X 10.5") ? true : false) : false,
// In iOS, if you move a video element in the DOM, it breaks video playback.
movingElementInDOM: !_V_.isIOS()
};
// Android
if (_V_.isAndroid()) {
// Override Android 2.2 and less canPlayType method which is broken
if (_V_.androidVersion() < 3) {
document.createElement("video").constructor.prototype.canPlayType = function(type){
return (type && type.toLowerCase().indexOf("video/mp4") != -1) ? "maybe" : "";
};
}
}
/* VideoJS-SWF - Custom Flash Player with HTML5-ish API
================================================================================ */
_V_.flash = _V_.PlaybackTech.extend({
init: function(player, options){
this.player = player;
var source = options.source,
parentEl = options.parentEl,
placeHolder = this.el = _V_.createElement("div", { id: parentEl.id + "_temp_flash" }),
objId = player.el.id+"_flash_api",
playerOptions = player.options;
flashVars = _V_.merge({
// SWF Callback Functions
readyFunction: "_V_.flash.onSWFReady",
eventProxyFunction: "_V_.flash.onSWFEvent",
errorEventProxyFunction: "_V_.flash.onSWFErrorEvent",
// Player Settings
autoplay: playerOptions.autoplay,
preload: playerOptions.preload,
loop: playerOptions.loop,
muted: playerOptions.muted
}, options.flashVars),
params = _V_.merge({
allowScriptAccess: "always",
wmode: "opaque",
bgcolor: "#000000"
}, options.params),
attributes = _V_.merge({
id: objId,
name: objId,
'class': 'vjs-tech'
}, options.attributes);
// EDIT: Trying to just us a manual <img> for poster.
// if (playerOptions.poster) {
// flashVars.poster = playerOptions.poster;
// }
// If source was supplied pass as a flash var.
if (source) {
flashVars.src = source.src;
}
// Add to box.
_V_.insertFirst(placeHolder, parentEl);
if (options.startTime) {
this.ready(function(){
this.load();
this.play();
this.currentTime(options.startTime);
});
}
swfobject.embedSWF(options.swf, placeHolder.id, "480", "270", "9.0.124", "", flashVars, params, attributes);
},
destroy: function(){
this.el.parentNode.removeChild(this.el);
},
// setupTriggers: function(){}, // Using global onSWFEvent func to distribute events
play: function(){ this.el.vjs_play(); },
pause: function(){ this.el.vjs_pause(); },
src: function(src){
this.el.vjs_src(src);
// Currently the SWF doesn't autoplay if you load a source later.
// e.g. Load player w/ no source, wait 2s, set src.
if (this.player.autoplay) {
var tech = this;
setTimeout(function(){ tech.play(); }, 0);
}
},
load: function(){ this.el.vjs_load(); },
poster: function(){ this.el.vjs_getProperty("poster"); },
buffered: function(){
return _V_.createTimeRange(0, this.el.vjs_getProperty("buffered"));
},
supportsFullScreen: function(){
return false; // Flash does not allow fullscreen through javascript
},
enterFullScreen: function(){
return false;
}
});
// Create setters and getters for attributes
(function(){
var api = _V_.flash.prototype,
readWrite = "preload,currentTime,defaultPlaybackRate,playbackRate,autoplay,loop,mediaGroup,controller,controls,volume,muted,defaultMuted".split(","),
readOnly = "error,currentSrc,networkState,readyState,seeking,initialTime,duration,startOffsetTime,paused,played,seekable,ended,videoTracks,audioTracks,videoWidth,videoHeight,textTracks".split(","),
callOnly = "load,play,pause".split(",");
// Overridden: buffered
createSetter = function(attr){
var attrUpper = attr.charAt(0).toUpperCase() + attr.slice(1);
api["set"+attrUpper] = function(val){ return this.el.vjs_setProperty(attr, val); };
},
createGetter = function(attr){
api[attr] = function(){ return this.el.vjs_getProperty(attr); };
};
// Create getter and setters for all read/write attributes
_V_.each(readWrite, function(attr){
createGetter(attr);
createSetter(attr);
});
// Create getters for read-only attributes
_V_.each(readOnly, function(attr){
createGetter(attr);
});
})();
/* Flash Support Testing -------------------------------------------------------- */
_V_.flash.isSupported = function(){
return swfobject.hasFlashPlayerVersion("10");
};
_V_.flash.canPlaySource = function(srcObj){
if (srcObj.type in _V_.flash.prototype.support.formats) { return "maybe"; }
};
_V_.flash.prototype.support = {
formats: {
"video/flv": "FLV",
"video/x-flv": "FLV",
"video/mp4": "MP4",
"video/m4v": "MP4"
},
// Optional events that we can manually mimic with timers
progressEvent: false,
timeupdateEvent: false,
// Resizing plugins using request fullscreen reloads the plugin
fullscreenResize: false,
// Resizing plugins in Firefox always reloads the plugin (e.g. full window mode)
parentResize: !(_V_.ua.match("Firefox"))
};
_V_.flash.onSWFReady = function(currSwf){
// _V_.log("swfReady", currSwf)
var el = _V_.el(currSwf);
// Get player from box
// On firefox reloads, el might already have a player
var player = el.player || el.parentNode.player,
tech = player.tech;
// Reference player on tech element
el.player = player;
// Update reference to playback technology element
tech.el = el;
// Now that the element is ready, make a click on the swf play the video
tech.addEvent("click", tech.onClick);
_V_.flash.checkReady(tech);
};
// The SWF isn't alwasy ready when it says it is. Sometimes the API functions still need to be added to the object.
// If it's not ready, we set a timeout to check again shortly.
_V_.flash.checkReady = function(tech){
if (tech.el.vjs_getProperty) {
tech.triggerReady();
} else {
setTimeout(function(){
_V_.flash.checkReady(tech);
}, 50);
}
};
_V_.flash.onSWFEvent = function(swfID, eventName, other){
try {
var player = _V_.el(swfID).player;
if (player && player.techName == "flash") {
player.triggerEvent(eventName);
}
} catch(err) {
_V_.log(err);
}
};
_V_.flash.onSWFErrorEvent = function(swfID, eventName){
_V_.log("Flash Error", eventName);
};
+132
Ver Arquivo
@@ -0,0 +1,132 @@
_V_.Track = function(attributes, player){
// Store reference to the parent player
this.player = player;
this.src = attributes.src;
this.kind = attributes.kind;
this.srclang = attributes.srclang;
this.label = attributes.label;
this["default"] = attributes["default"]; // 'default' is reserved-ish
this.title = attributes.title;
this.cues = [];
this.currentCue = false;
this.lastCueIndex = 0;
// Update current cue on timeupdate
player.addEvent("timeupdate", _V_.proxy(this, this.update));
// Reset cue time on media end
player.addEvent("ended", _V_.proxy(this, function() { this.lastCueIndex = 0; }));
// Load Track File
_V_.get(attributes.src, _V_.proxy(this, this.parseCues));
};
_V_.Track.prototype = {
parseCues: function(srcContent) {
var cue, time, text,
lines = srcContent.split("\n"),
line = "";
for (var i=0; i<lines.length; i++) {
line = _V_.trim(lines[i]); // Trim whitespace and linebreaks
if (line) { // Loop until a line with content
// First line - Number
cue = {
id: line, // Cue Number
index: this.cues.length // Position in Array
};
// Second line - Time
line = _V_.trim(lines[++i]);
time = line.split(" --> ");
cue.startTime = this.parseCueTime(time[0]);
cue.endTime = this.parseCueTime(time[1]);
// Additional lines - Cue Text
text = [];
for (var j=i; j<lines.length; j++) { // Loop until a blank line or end of lines
line = _V_.trim(lines[++i]);
if (!line) { break; }
text.push(line);
}
cue.text = text.join('<br/>');
// Add this cue
this.cues.push(cue);
}
}
},
parseCueTime: function(timeText) {
var parts = timeText.split(':'),
time = 0;
// hours => seconds
time += parseFloat(parts[0])*60*60;
// minutes => seconds
time += parseFloat(parts[1])*60;
// get seconds
var seconds = parts[2].split(/\.|,/); // Either . or ,
time += parseFloat(seconds[0]);
// add miliseconds
ms = parseFloat(seconds[1]);
if (ms) { time += ms/1000; }
return time;
},
update: function(){
// Assuming all cues are in order by time, and do not overlap
if (this.cues && this.cues.length > 0) {
var time = this.player.currentTime();
// If current cue should stay showing, don't do anything. Otherwise, find new cue.
if (!this.currentCue || this.currentCue.startTime >= time || this.currentCue.endTime < time) {
var newSubIndex = false,
// Loop in reverse if lastCue is after current time (optimization)
// Meaning the user is scrubbing in reverse or rewinding
reverse = (this.cues[this.lastCueIndex].startTime > time),
// If reverse, step back 1 becase we know it's not the lastCue
i = this.lastCueIndex - (reverse ? 1 : 0);
while (true) { // Loop until broken
if (reverse) { // Looping in reverse
// Stop if no more, or this cue ends before the current time (no earlier cues should apply)
if (i < 0 || this.cues[i].endTime < time) { break; }
// End is greater than time, so if start is less, show this cue
if (this.cues[i].startTime < time) {
newSubIndex = i;
break;
}
i--;
} else { // Looping forward
// Stop if no more, or this cue starts after time (no later cues should apply)
if (i >= this.cues.length || this.cues[i].startTime > time) { break; }
// Start is less than time, so if end is later, show this cue
if (this.cues[i].endTime > time) {
newSubIndex = i;
break;
}
i++;
}
}
// Set or clear current cue
if (newSubIndex !== false) {
this.currentCue = this.cues[newSubIndex];
this.lastCueIndex = newSubIndex;
this.updatePlayer(this.currentCue.text);
} else if (this.currentCue) {
this.currentCue = false;
this.updatePlayer("");
}
}
}
},
// Update the stored value for the current track kind
// and trigger an event to update all text track displays.
updatePlayer: function(text){
this.player.textTrackValue(this.kind, text);
}
};
Diff do arquivo suprimido porque uma ou mais linhas são muito longas
+20
Ver Arquivo
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<title>VideoJS | HTML5 Video Player</title>
<link href="video-js.css" rel="stylesheet" type="text/css">
<!-- video.js must be in the <head> for older IEs to work. -->
<script src="video.js"></script>
</head>
<body>
<video id="example_video_1" class="video-js vjs-default-skin" controls width="640" height="264" data-setup='{"techOrder":["youtube","html5"]}'>
<source src="http://www.youtube.com/watch?v=YjaZNYSt7o0" type='video/youtube'>
</video>
</body>
</html>
+147
Ver Arquivo
@@ -0,0 +1,147 @@
// Flowplayer API Connector
VideoJS.tech.youtube = {
name: "YouTube",
supported: function(){
// Flash Player 8 or higher
return true;
},
canPlaySource: function(sourceObj){
return sourceObj.type == "video/youtube";
},
supports: {
format: {},
event: {
progress: false,
timeupdate: false
}
},
init: function(sourceObj){
var player = this,
placeHolder = _V_.createElement("div", { id: player.box.id + "_temp_ytswf" }),
objId = player.box.id+"_youtube_api";
flashvars = {
},
params = {
allowScriptAccess: "always",
wmode: "opaque",
bgcolor: "#000000"
},
attributes = {
id: objId,
name: objId,
'class': 'vjs-tech'
};
this.addEvent("techready", function(){
var url = sourceObj.src;
if (url.indexOf("http://") == 0) {
// Get Youtube ID from URL
url = url.match(/v=([^&]+)/)[1];
}
this.tels.youtube.cueVideoById(url);
});
player.box.appendChild(placeHolder);
swfobject.embedSWF("http://www.youtube.com/apiplayer?" +
"version=3&enablejsapi=1&playerapiid=" + objId,
placeHolder.id, "480", "295", "9", null, null, params, attributes);
},
stateChange: function(id, state){
var player = _V_(id);
if (state == 0) {
player.triggerEvent("ended");
} else if (state == 1) {
player.triggerEvent("play");
player.triggerEvent("playing");
} else if (state == 2) {
player.triggerEvent("pause");
}
},
error: function(id, errorCode){
_V_.log(id, errorCode);
},
api: {
setupTriggers: function(){
this.tels.youtube.addEventListener("onStateChange",
"(function(state){ _V_.tech.youtube.stateChange('"+this.id+"',state); })");
this.tels.youtube.addEventListener("onError",
"(function(errorCode){ _V_.tech.youtube.error('"+this.id+"',errorCode); })");
},
play: function(){ this.tels.youtube.playVideo(); },
pause: function(){ this.tels.youtube.pauseVideo(); },
paused: function(){
return this.tels.youtube.getPlayerState() !== 1; // More accurate than isPaused
},
currentTime: function(){ return this.tels.youtube.getCurrentTime(); },
setCurrentTime: function(seconds){
// False blocks seek-ahead.
this.tels.youtube.seekTo(seconds, true);
},
duration: function(){
return this.tels.youtube.getDuration();
},
buffered: function(){
var percent = this.tels.youtube.getVideoBytesLoaded() / this.tels.youtube.getVideoBytesTotal(),
seconds = this.duration() * percent;
return _V_.createTimeRange(0, seconds);
},
volume: function(){ return _V_.round(this.tels.youtube.getVolume() / 100, 2); },
setVolume: function(percentAsDecimal){
this.tels.youtube.setVolume(parseInt(percentAsDecimal * 100));
// Youtube Doesn't support VolumeChange Events
this.triggerEvent("volumechange");
},
muted: function(){ return this.tels.youtube.isMuted(); },
setMuted: function(bool){
if (bool) {
this.tels.youtube.mute()
} else {
this.tels.youtube.unMute()
}
},
supportsFullScreen: function(){
return false; // Flash does not allow fullscreen through javascript
// Maybe at click listener, and say "click screen".
},
enterFullScreen: function(){ this.tels.flowplayer.api.toggleFullscreen(); },
src: function(src){
this.tels.youtube.cueVideoById(src);
},
load: function(){
// Youtube will autoload?
}
}
};
// YouTube Defined Player Ready Callback
window.onYouTubePlayerReady = function(playerId) {
var el = _V_.el(playerId),
player = el.parentNode.player; // Get player from box
el.player = player;
// Update reference to playback technology element
player.tels.youtube = el;
player.triggerEvent("techready");
}
Arquivo executável
+7
Ver Arquivo
@@ -0,0 +1,7 @@
.project
*~
*.diff
*.patch
.DS_Store
.settings
Arquivo executável
+27
Ver Arquivo
@@ -0,0 +1,27 @@
[QUnit](http://docs.jquery.com/QUnit) - A JavaScript Unit Testing framework.
================================
QUnit is a powerful, easy-to-use, JavaScript test suite. It's used by the jQuery
project to test its code and plugins but is capable of testing any generic
JavaScript code (and even capable of testing JavaScript code on the server-side).
QUnit is especially useful for regression testing: Whenever a bug is reported,
write a test that asserts the existence of that particular bug. Then fix it and
commit both. Every time you work on the code again, run the tests. If the bug
comes up again - a regression - you'll spot it immediately and know how to fix
it, because you know what code you just changed.
Having good unit test coverage makes safe refactoring easy and cheap. You can
run the tests after each small refactoring step and always know what change
broke something.
QUnit is similar to other unit testing frameworks like JUnit, but makes use of
the features JavaScript provides and helps with testing code in the browser, eg.
with it's stop/start facilities for testing asynchronous code.
If you are interested in helping developing QUnit, you are in the right place.
For related discussions, visit the
[QUnit and Testing forum](http://forum.jquery.com/qunit-and-testing).
Planning for a qunitjs.com site and other testing tools related work now happens
on the [jQuery Testing Team planning wiki](http://jquerytesting.pbworks.com/w/page/41556026/FrontPage).
+16
Ver Arquivo
@@ -0,0 +1,16 @@
Canvas - A QUnit Addon For Testing Canvas Rendering
================================
This addon for QUnit adds a pixelEqual method that allows you to assert
individual pixel values in a given canvas.
Usage:
pixelEqual(canvas, x, y, r, g, b, a, message)
Where:
* canvas: Reference to a canvas element
* x, y: Coordinates of the pixel to test
* r, g, b, a: The color and opacity value of the pixel that you except
* message: Optional message, same as for other assertions
+76
Ver Arquivo
@@ -0,0 +1,76 @@
test("Canvas pixels", function () {
var canvas = document.getElementById('qunit-canvas'), context;
try {
context = canvas.getContext('2d');
} catch(e) {
// propably no canvas support, just exit
return;
}
context.fillStyle = 'rgba(0, 0, 0, 0)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 0, 0, 0, 0, 0, 0);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(255, 0, 0, 0)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 0, 0, 0, 0, 0, 0);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(0, 255, 0, 0)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 0, 0, 0, 0, 0, 0);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(0, 0, 255, 0)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 0, 0, 0, 0, 0, 0);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(0, 0, 0, 0.5)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 0, 0, 0, 0, 0, 127);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(255, 0, 0, 0.5)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 0, 0, 255, 0, 0, 127);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(0, 255, 0, 0.5)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 0, 0, 0, 255, 0, 127);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(0, 0, 255, 0.5)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 0, 0, 0, 0, 255, 127);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(0, 0, 0, 0.5)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 2, 2, 0, 0, 0, 127);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(255, 0, 0, 0.5)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 2, 2, 255, 0, 0, 127);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(0, 255, 0, 0.5)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 2, 2, 0, 255, 0, 127);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(0, 0, 255, 0.5)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 2, 2, 0, 0, 255, 127);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(0, 0, 0, 1)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 4, 4, 0, 0, 0, 255);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(255, 0, 0, 1)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 4, 4, 255, 0, 0, 255);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(0, 255, 0, 1)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 4, 4, 0, 255, 0, 255);
context.clearRect(0,0,5,5);
context.fillStyle = 'rgba(0, 0, 255, 1)';
context.fillRect(0, 0, 5, 5);
QUnit.pixelEqual(canvas, 4, 4, 0, 0, 255, 255);
context.clearRect(0,0,5,5);
});
+19
Ver Arquivo
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>QUnit Test Suite - Canvas Addon</title>
<link rel="stylesheet" href="../../qunit/qunit.css" type="text/css" media="screen">
<script type="text/javascript" src="../../qunit/qunit.js"></script>
<script type="text/javascript" src="qunit-canvas.js"></script>
<script type="text/javascript" src="canvas-test.js"></script>
</head>
<body>
<h1 id="qunit-header">QUnit Test Suite - Canvas Addon</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<canvas id="qunit-canvas" width="5" height="5"></canvas>
</body>
</html>
+6
Ver Arquivo
@@ -0,0 +1,6 @@
QUnit.extend( QUnit, {
pixelEqual: function(canvas, x, y, r, g, b, a, message) {
var actual = Array.prototype.slice.apply(canvas.getContext('2d').getImageData(x, y, 1, 1).data), expected = [r, g, b, a];
QUnit.push(QUnit.equiv(actual, expected), actual, expected, message);
}
});
+17
Ver Arquivo
@@ -0,0 +1,17 @@
Close-Enough - A QUnit Addon For Number Approximations
================================
This addon for QUnit adds close and notClose assertion methods, to test that
numbers are close enough (or different enough) from an expected number, with
a specified accuracy.
Usage:
close(actual, expected, maxDifference, message)
notClose(actual, expected, minDifference, message)
Where:
* maxDifference: the maximum inclusive difference allowed between the actual and expected numbers
* minDifference: the minimum exclusive difference allowed between the actual and expected numbers
* actual, expected, message: The usual
+37
Ver Arquivo
@@ -0,0 +1,37 @@
test("Close Numbers", function () {
QUnit.close(7, 7, 0);
QUnit.close(7, 7.1, 0.1);
QUnit.close(7, 7.1, 0.2);
QUnit.close(3.141, Math.PI, 0.001);
QUnit.close(3.1, Math.PI, 0.1);
var halfPi = Math.PI / 2;
QUnit.close(halfPi, 1.57, 0.001);
var sqrt2 = Math.sqrt(2);
QUnit.close(sqrt2, 1.4142, 0.0001);
QUnit.close(Infinity, Infinity, 1);
});
test("Distant Numbers", function () {
QUnit.notClose(6, 7, 0);
QUnit.notClose(7, 7.2, 0.1);
QUnit.notClose(7, 7.2, 0.19999999999);
QUnit.notClose(3.141, Math.PI, 0.0001);
QUnit.notClose(3.1, Math.PI, 0.001);
var halfPi = Math.PI / 2;
QUnit.notClose(halfPi, 1.57, 0.0001);
var sqrt2 = Math.sqrt(2);
QUnit.notClose(sqrt2, 1.4142, 0.00001);
QUnit.notClose(Infinity, -Infinity, 5);
});
+18
Ver Arquivo
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>QUnit Test Suite - Close Enough Addon</title>
<link rel="stylesheet" href="../../qunit/qunit.css" type="text/css" media="screen">
<script type="text/javascript" src="../../qunit/qunit.js"></script>
<script type="text/javascript" src="qunit-close-enough.js"></script>
<script type="text/javascript" src="close-enough-test.js"></script>
</head>
<body>
<h1 id="qunit-header">QUnit Test Suite - Close Enough</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
</body>
</html>
+32
Ver Arquivo
@@ -0,0 +1,32 @@
QUnit.extend( QUnit, {
/**
* Checks that the first two arguments are equal, or are numbers close enough to be considered equal
* based on a specified maximum allowable difference.
*
* @example close(3.141, Math.PI, 0.001);
*
* @param Number actual
* @param Number expected
* @param Number maxDifference (the maximum inclusive difference allowed between the actual and expected numbers)
* @param String message (optional)
*/
close: function(actual, expected, maxDifference, message) {
var passes = (actual === expected) || Math.abs(actual - expected) <= maxDifference;
QUnit.push(passes, actual, expected, message);
},
/**
* Checks that the first two arguments are numbers with differences greater than the specified
* minimum difference.
*
* @example notClose(3.1, Math.PI, 0.001);
*
* @param Number actual
* @param Number expected
* @param Number minDifference (the minimum exclusive difference allowed between the actual and expected numbers)
* @param String message (optional)
*/
notClose: function(actual, expected, minDifference, message) {
QUnit.push(Math.abs(actual - expected) > minDifference, actual, expected, message);
}
});
+7
Ver Arquivo
@@ -0,0 +1,7 @@
Composite - A QUnit Addon For Running Multiple Test Files
================================
Composite is a QUnit addon that, when handed an array of files, will
open each of those files inside of an iframe, run the tests and
display the results as a single suite of QUnit tests.
+33
Ver Arquivo
@@ -0,0 +1,33 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>QUnit SubsuiteRunner Test Suite</title>
<link rel="stylesheet" href="../../qunit/qunit.css" type="text/css" media="screen">
<link rel="stylesheet" href="qunit-composite.css">
<script src="../../qunit/qunit.js"></script>
<script src="qunit-composite.js"></script>
<script>
QUnit.testSuites([
"../../test/index.html",
"../canvas/canvas.html",
"../close-enough/close-enough.html",
"../step/step.html",
"composite-test.html"
]);
</script>
</head>
<body>
<h1 id="qunit-header">QUnit SubsuiteRunner Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture">
</div>
</body>
</html>
+20
Ver Arquivo
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>QUnit Core Test Suite</title>
<link rel="stylesheet" href="../../qunit/qunit.css" type="text/css" media="screen">
<script src="../../qunit/qunit.js"></script>
<script src="qunit-composite.js"></script>
<script src="composite-test.js"></script>
</head>
<body>
<h1 id="qunit-header">QUnit Core Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture">test markup</div>
</body>
</html>
+159
Ver Arquivo
@@ -0,0 +1,159 @@
module( "testSuites tests", (function(){
var asyncTest = QUnit.asyncTest,
runSuite = QUnit.runSuite;
return {
setup: function(){
//proxy asyncTest and runSuite
QUnit.asyncTest = window.asyncTest = function( name, callback ){
ok( true, "asyncTestCalled for each suite" );
callback(); //don't acutally create tests, just call callback
};
QUnit.runSuite = window.runSuite = function(){
ok( true, "runSuite called for each suite" );
};
//ensure that subsuite's done doesn't run
this.oldDone = QUnit.done;
},
teardown: function(){
//restore
QUnit.asyncTest = window.asyncTest = asyncTest;
QUnit.runSuite = window.runSuite = runSuite;
QUnit.done = this.oldDone;
}
};
})());
test( "proper number of asyncTest and runSuite calls", function(){
expect( 6 );
QUnit.testSuites( ["one.html", "two.html", "three.html"] );
});
test( "done callback changed", function(){
QUnit.testSuites( ["dummy.html"] );
notEqual( this.oldDone, QUnit.done, "done callback should be set" );
});
module( "testStart tests", (function(){
var id = QUnit.id;
return {
setup: function(){
//proxy id
var fakeElem = this.fakeElem = document.createElement( "div" );
QUnit.id = function(){
return fakeElem;
}
},
teardown: function(){
QUnit.id = id;
}
};
})());
test( "running message printed", function(){
var hello = "hello world",
expected = "Running " + hello + "...<br>&nbsp;";
QUnit.testStart( {name: hello} );
equal( this.fakeElem.innerHTML, expected, "innerHTML was set correctly by testStart" );
});
module( "testDone tests", (function(){
var id = QUnit.id;
return {
setup: function(){
//proxy id
var fakeElem = this.fakeElem = document.createElement( "div" );
fakeElem.appendChild( document.createElement( "ol" ) );
fakeElem.appendChild( document.createElement( "ol" ) );
QUnit.id = function(){
return fakeElem;
}
},
teardown: function(){
QUnit.id = id;
}
};
})());
test( "test expansions are hidden", function(){
QUnit.testDone();
equal( this.fakeElem.children[0].style.display, "none", "first ol display is none" );
equal( this.fakeElem.children[1].style.display, "none", "second ol display is none" );
});
test( "non-ol elements aren't hidden", function(){
this.fakeElem.appendChild( document.createElement( "span" ) );
QUnit.testDone();
notEqual( this.fakeElem.children[2].style.display, "none", "first ol display is none" );
});
module( "runSuite tests", (function(){
var getElementsByTagName = document.getElementsByTagName,
createElement = document.createElement,
runSuite = QUnit.runSuite;
return {
setup: function(){
//proxy getElementsByTagName and createElement
var setAttributeCall = this.setAttributeCall = {},
appendChildCall = this.appendChildCall = {called: 0},
iframeLoad = this.iframeLoad = {},
iframeQUnitObject = this.iframeQUnitObject = {},
fakeElement = {
appendChild: function(){appendChildCall.called++},
setAttribute: function(){setAttributeCall.args = arguments},
addEventListener: function( type, callback ){iframeLoad.callback = callback;},
contentWindow: {QUnit: iframeQUnitObject},
className: "",
};
document.getElementsByTagName = function(){
return [fakeElement];
};
document.createElement = function(){
return fakeElement;
}
},
teardown: function(){
document.getElementsByTagName = getElementsByTagName;
document.createElement = createElement;
//must restore even though we didn't proxy; the runner overwrites upon first call
QUnit.runSuite = runSuite;
}
};
})());
test( "runSuite different after first run", function(){
var before = QUnit.runSuite,
after;
QUnit.runSuite();
after = QUnit.runSuite;
notEqual( before, after, "runSuite changed after initial run" );
});
test( "iframe only created once", function(){
QUnit.runSuite();
equal( this.appendChildCall.called, 1, "append child called once" );
QUnit.runSuite();
equal( this.appendChildCall.called, 1, "append child only ever called once" );
});
test( "iframe's QUnit object is modified when iframe source loads", function(){
var before = this.iframeQUnitObject,
after;
QUnit.runSuite();
this.iframeLoad.callback();
notEqual( before, after, "iframe's qunit object is modified upon load");
});
test( "iframe src set to suite passed", function(){
var pages = ["testing.html", "subsuiteRunner.html"];
QUnit.runSuite( pages[0] );
equal( this.setAttributeCall.args[0], "src", "src attribute set" );
equal( this.setAttributeCall.args[1], pages[0], "src attribute set" );
QUnit.runSuite( pages[1] );
equal( this.setAttributeCall.args[1], pages[1], "src attribute set" );
});
+19
Ver Arquivo
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>QUnit Core Test Suite</title>
<link rel="stylesheet" href="../../qunit/qunit.css" type="text/css" media="screen">
<script src="../../qunit/qunit.js"></script>
<script src="../../test/test.js"></script>
</head>
<body>
<h1 id="qunit-header">QUnit Core Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture">test markup</div>
</body>
</html>
+19
Ver Arquivo
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>QUnit Same Test Suite</title>
<link rel="stylesheet" href="../../qunit/qunit.css" type="text/css" media="screen">
<script src="../../qunit/qunit.js"></script>
<script src="../../test/same.js"></script>
</head>
<body>
<h1 id="qunit-header">QUnit Same Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture">test markup</div>
</body>
</html>
+35
Ver Arquivo
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Composite</title>
</head>
<body>
<h1>Composite</h1>
<h3>A QUnit Addon For Running Multiple Test Files</h3>
<p>Composite is a QUnit addon that, when handed an array of
files, will open each of those files inside of an iframe, run
the tests and display the results as a single suite of QUnit
tests.</p>
<h4>Using Composite</h4>
<p>To use Composite, setup a standard QUnit html page as you
would with other QUnit tests. Remember to include composite.js
and composite.css. Then, inside of either an external js file,
or a script block call the only new method that Composite
exposes, QUnit.testSuites().</p><p>QUnit.testSuites() is
passed an array of test files to run as follows:</p>
<pre>
QUnit.testSuites([
"test-file-1.html",
"test-file-2.html",
"test-file-3.html"
]);
</pre>
<h4>Tests</h4>
<p>Composite has tests of it's own.</p>
<p>
<a href="composite-test.html">Composite Test</a>: A suite which tests the implementation of composite.<br>
<a href="composite-demo-test.html">Composite Demo</a>: A suite which demoes how Compisite is bootstrapped and run.
</p>
</body>
</html>
+13
Ver Arquivo
@@ -0,0 +1,13 @@
iframe.qunit-subsuite{
position: fixed;
bottom: 0;
left: 0;
margin: 0;
padding: 0;
border-width: 1px 0 0;
height: 45%;
width: 100%;
background: #fff;
}
+82
Ver Arquivo
@@ -0,0 +1,82 @@
(function( QUnit ) {
var subsuiteFrame;
QUnit.extend( QUnit, {
testSuites: function( suites ) {
for ( var i = 0; i < suites.length; i++ ) {
(function( suite ) {
asyncTest( suite, function() {
QUnit.runSuite( suite );
});
}( suites[i] ) );
}
QUnit.done = function() {
subsuiteFrame.style.display = "none";
};
},
testStart: function( data ) {
// update the test status to show which test suite is running
QUnit.id( "qunit-testresult" ).innerHTML = "Running " + data.name + "...<br>&nbsp;";
},
testDone: function() {
var current = QUnit.id( this.config.current.id ),
children = current.children;
// undo the auto-expansion of failed tests
for ( var i = 0; i < children.length; i++ ) {
if ( children[i].nodeName === "OL" ) {
children[i].style.display = "none";
}
}
},
runSuite: function( suite ) {
var body = document.getElementsByTagName( "body" )[0],
iframe = subsuiteFrame = document.createElement( "iframe" ),
iframeWin;
iframe.className = "qunit-subsuite";
body.appendChild( iframe );
function onIframeLoad() {
var module, test,
count = 0;
QUnit.extend( iframeWin.QUnit, {
moduleStart: function( data ) {
// capture module name for messages
module = data.name;
},
testStart: function( data ) {
// capture test name for messages
test = data.name;
},
log: function( data ) {
// pass all test details through to the main page
var message = module + ": " + test + ": " + data.message;
expect( ++count );
QUnit.push( data.result, data.actual, data.expected, message );
},
done: function() {
// start the wrapper test from the main page
start();
}
});
}
QUnit.addEvent( iframe, "load", onIframeLoad );
iframeWin = iframe.contentWindow;
iframe.setAttribute( "src", suite );
this.runSuite = function( suite ) {
iframe.setAttribute( "src", suite );
};
}
});
}( QUnit ) );
+18
Ver Arquivo
@@ -0,0 +1,18 @@
QUnit.step() - A QUnit Addon For Testing execution in order
============================================================
This addon for QUnit adds a step method that allows you to assert
the proper sequence in which the code should execute.
Example:
test("example test", function () {
function x() {
QUnit.step(2, "function y should be called first");
}
function y() {
QUnit.step(1);
}
y();
x();
});
+25
Ver Arquivo
@@ -0,0 +1,25 @@
QUnit.extend( QUnit, {
/**
* Check the sequence/order
*
* @example step(1); setTimeout(function () { step(3); }, 100); step(2);
* @param Number expected The excepted step within the test()
* @param String message (optional)
*/
step: function (expected, message) {
this.config.current.step++; // increment internal step counter.
if (typeof message == "undefined") {
message = "step " + expected;
}
var actual = this.config.current.step;
QUnit.push(QUnit.equiv(actual, expected), actual, expected, message);
}
});
/**
* Reset the step counter for every test()
*/
QUnit.testStart(function () {
this.config.current.step = 0;
});
+13
Ver Arquivo
@@ -0,0 +1,13 @@
module('Step Addon');
test("step", 3, function () {
QUnit.step(1, "step starts at 1");
setTimeout(function () {
start();
QUnit.step(3);
}, 100);
QUnit.step(2, "before the setTimeout callback is run");
stop();
});
test("step counter", 1, function () {
QUnit.step(1, "each test has its own step counter");
});
+19
Ver Arquivo
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>QUnit Test Suite - Step Addon</title>
<link rel="stylesheet" href="../../qunit/qunit.css" type="text/css" media="screen">
<script type="text/javascript" src="../../qunit/qunit.js"></script>
<script type="text/javascript" src="qunit-step.js"></script>
<script type="text/javascript" src="step-test.js"></script>
</head>
<body>
<h1 id="qunit-header">QUnit Test Suite - Step Addon</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<canvas id="qunit-canvas" width="5" height="5"></canvas>
</body>
</html>
Arquivo executável
+27
Ver Arquivo
@@ -0,0 +1,27 @@
{
"name": "qunit",
"author": "The jQuery Project",
"contributors": [
{
"name": "John Resig",
"email": "jeresig@gmail.com",
"url": "http://ejohn.org/"
},
{
"name": "Jörn Zaefferer",
"email": "joern.zaefferer@googlemail.com",
"url": "http://bassistance.de/"
}],
"url": "http://docs.jquery.com/QUnit",
"repositories" : [{
"type": "git",
"url": "https://github.com/jquery/qunit.git"
}],
"license": {
"name": "MIT",
"url": "http://www.opensource.org/licenses/mit-license.php"
},
"description": "An easy-to-use JavaScript Unit Testing framework.",
"keywords": [ "testing", "unit", "jquery" ],
"main": "qunit/qunit.js"
}
Arquivo executável
+226
Ver Arquivo
@@ -0,0 +1,226 @@
/**
* QUnit - A JavaScript Unit Testing Framework
*
* http://docs.jquery.com/QUnit
*
* Copyright (c) 2011 John Resig, Jörn Zaefferer
* Dual licensed under the MIT (MIT-LICENSE.txt)
* or GPL (GPL-LICENSE.txt) licenses.
*/
/** Font Family and Sizes */
#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
}
#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
#qunit-tests { font-size: smaller; }
/** Resets */
#qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult {
margin: 0;
padding: 0;
}
/** Header */
#qunit-header {
padding: 0.5em 0 0.5em 1em;
color: #8699a4;
background-color: #0d3349;
font-size: 1.5em;
line-height: 1em;
font-weight: normal;
border-radius: 15px 15px 0 0;
-moz-border-radius: 15px 15px 0 0;
-webkit-border-top-right-radius: 15px;
-webkit-border-top-left-radius: 15px;
}
#qunit-header a {
text-decoration: none;
color: #c2ccd1;
}
#qunit-header a:hover,
#qunit-header a:focus {
color: #fff;
}
#qunit-banner {
height: 5px;
}
#qunit-testrunner-toolbar {
padding: 0.5em 0 0.5em 2em;
color: #5E740B;
background-color: #eee;
}
#qunit-userAgent {
padding: 0.5em 0 0.5em 2.5em;
background-color: #2b81af;
color: #fff;
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
}
/** Tests: Pass/Fail */
#qunit-tests {
list-style-position: inside;
}
#qunit-tests li {
padding: 0.4em 0.5em 0.4em 2.5em;
border-bottom: 1px solid #fff;
list-style-position: inside;
}
#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running {
display: none;
}
#qunit-tests li strong {
cursor: pointer;
}
#qunit-tests li a {
padding: 0.5em;
color: #c2ccd1;
text-decoration: none;
}
#qunit-tests li a:hover,
#qunit-tests li a:focus {
color: #000;
}
#qunit-tests ol {
margin-top: 0.5em;
padding: 0.5em;
background-color: #fff;
border-radius: 15px;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
box-shadow: inset 0px 2px 13px #999;
-moz-box-shadow: inset 0px 2px 13px #999;
-webkit-box-shadow: inset 0px 2px 13px #999;
}
#qunit-tests table {
border-collapse: collapse;
margin-top: .2em;
}
#qunit-tests th {
text-align: right;
vertical-align: top;
padding: 0 .5em 0 0;
}
#qunit-tests td {
vertical-align: top;
}
#qunit-tests pre {
margin: 0;
white-space: pre-wrap;
word-wrap: break-word;
}
#qunit-tests del {
background-color: #e0f2be;
color: #374e0c;
text-decoration: none;
}
#qunit-tests ins {
background-color: #ffcaca;
color: #500;
text-decoration: none;
}
/*** Test Counts */
#qunit-tests b.counts { color: black; }
#qunit-tests b.passed { color: #5E740B; }
#qunit-tests b.failed { color: #710909; }
#qunit-tests li li {
margin: 0.5em;
padding: 0.4em 0.5em 0.4em 0.5em;
background-color: #fff;
border-bottom: none;
list-style-position: inside;
}
/*** Passing Styles */
#qunit-tests li li.pass {
color: #5E740B;
background-color: #fff;
border-left: 26px solid #C6E746;
}
#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
#qunit-tests .pass .test-name { color: #366097; }
#qunit-tests .pass .test-actual,
#qunit-tests .pass .test-expected { color: #999999; }
#qunit-banner.qunit-pass { background-color: #C6E746; }
/*** Failing Styles */
#qunit-tests li li.fail {
color: #710909;
background-color: #fff;
border-left: 26px solid #EE5757;
white-space: pre;
}
#qunit-tests > li:last-child {
border-radius: 0 0 15px 15px;
-moz-border-radius: 0 0 15px 15px;
-webkit-border-bottom-right-radius: 15px;
-webkit-border-bottom-left-radius: 15px;
}
#qunit-tests .fail { color: #000000; background-color: #EE5757; }
#qunit-tests .fail .test-name,
#qunit-tests .fail .module-name { color: #000000; }
#qunit-tests .fail .test-actual { color: #EE5757; }
#qunit-tests .fail .test-expected { color: green; }
#qunit-banner.qunit-fail { background-color: #EE5757; }
/** Result */
#qunit-testresult {
padding: 0.5em 0.5em 0.5em 2.5em;
color: #2b81af;
background-color: #D2E0E6;
border-bottom: 1px solid white;
}
/** Fixture */
#qunit-fixture {
position: absolute;
top: -10000px;
left: -10000px;
}
Arquivo executável
+1552
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+24
Ver Arquivo
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<title>QUnit Test Suite</title>
<link rel="stylesheet" href="../qunit/qunit.css" type="text/css" media="screen">
<script type="text/javascript" src="../qunit/qunit.js"></script>
<script type="text/javascript" src="test.js"></script>
<script type="text/javascript" src="same.js"></script>
<script>
var logs = ["begin", "testStart", "testDone", "log", "moduleStart", "moduleDone", "done"];
for (var i = 0; i < logs.length; i++) {
(function() {
var log = logs[i];
QUnit[log] = function() {
console.log(log, arguments);
};
})();
}
</script>
</head>
<body>
<div id="qunit-fixture">test markup</div>
</body>
</html>
Arquivo executável
+19
Ver Arquivo
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>QUnit Test Suite</title>
<link rel="stylesheet" href="../qunit/qunit.css" type="text/css" media="screen">
<script type="text/javascript" src="../qunit/qunit.js"></script>
<script type="text/javascript" src="test.js"></script>
<script type="text/javascript" src="same.js"></script>
</head>
<body>
<h1 id="qunit-header">QUnit Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture">test markup</div>
</body>
</html>
Arquivo executável
+17
Ver Arquivo
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<title>QUnit Test Suite</title>
<link rel="stylesheet" href="../qunit/qunit.css" type="text/css" media="screen">
<script type="text/javascript" src="../qunit/qunit.js"></script>
<script type="text/javascript" src="logs.js"></script>
</head>
<body>
<h1 id="qunit-header">QUnit Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture">test markup</div>
</body>
</html>
Arquivo executável
+153
Ver Arquivo
@@ -0,0 +1,153 @@
// TODO disable reordering for this suite!
var begin = 0,
moduleStart = 0,
moduleDone = 0,
testStart = 0,
testDone = 0,
log = 0,
moduleContext,
moduleDoneContext,
testContext,
testDoneContext,
logContext;
QUnit.begin(function() {
begin++;
});
QUnit.done(function() {
});
QUnit.moduleStart(function(context) {
moduleStart++;
moduleContext = context;
});
QUnit.moduleDone(function(context) {
moduleDone++;
moduleDoneContext = context;
});
QUnit.testStart(function(context) {
testStart++;
testContext = context;
});
QUnit.testDone(function(context) {
testDone++;
testDoneContext = context;
});
QUnit.log(function(context) {
log++;
logContext = context;
});
var logs = ["begin", "testStart", "testDone", "log", "moduleStart", "moduleDone", "done"];
for (var i = 0; i < logs.length; i++) {
(function() {
var log = logs[i];
QUnit[log](function() {
console.log(log, arguments);
});
})();
}
module("logs1");
test("test1", 13, function() {
equal(begin, 1);
equal(moduleStart, 1);
equal(testStart, 1);
equal(testDone, 0);
equal(moduleDone, 0);
deepEqual(logContext, {
result: true,
message: undefined,
actual: 0,
expected: 0
});
equal("foo", "foo", "msg");
deepEqual(logContext, {
result: true,
message: "msg",
actual: "foo",
expected: "foo"
});
strictEqual(testDoneContext, undefined);
deepEqual(testContext, {
module: "logs1",
name: "test1"
});
strictEqual(moduleDoneContext, undefined);
deepEqual(moduleContext, {
name: "logs1"
});
equal(log, 12);
});
test("test2", 10, function() {
equal(begin, 1);
equal(moduleStart, 1);
equal(testStart, 2);
equal(testDone, 1);
equal(moduleDone, 0);
deepEqual(testDoneContext, {
module: "logs1",
name: "test1",
failed: 0,
passed: 13,
total: 13
});
deepEqual(testContext, {
module: "logs1",
name: "test2"
});
strictEqual(moduleDoneContext, undefined);
deepEqual(moduleContext, {
name: "logs1"
});
equal(log, 22);
});
module("logs2");
test("test1", 9, function() {
equal(begin, 1);
equal(moduleStart, 2);
equal(testStart, 3);
equal(testDone, 2);
equal(moduleDone, 1);
deepEqual(testContext, {
module: "logs2",
name: "test1"
});
deepEqual(moduleDoneContext, {
name: "logs1",
failed: 0,
passed: 23,
total: 23
});
deepEqual(moduleContext, {
name: "logs2"
});
equal(log, 31);
});
test("test2", 8, function() {
equal(begin, 1);
equal(moduleStart, 2);
equal(testStart, 4);
equal(testDone, 3);
equal(moduleDone, 1);
deepEqual(testContext, {
module: "logs2",
name: "test2"
});
deepEqual(moduleContext, {
name: "logs2"
});
equal(log, 39);
});
Arquivo executável
+1421
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
Arquivo executável
+471
Ver Arquivo
@@ -0,0 +1,471 @@
test("module without setup/teardown (default)", function() {
expect(1);
ok(true);
});
test("expect in test", 3, function() {
ok(true);
ok(true);
ok(true);
});
test("expect in test", 1, function() {
ok(true);
});
module("setup test", {
setup: function() {
ok(true);
}
});
test("module with setup", function() {
expect(2);
ok(true);
});
test("module with setup, expect in test call", 2, function() {
ok(true);
});
var state;
module("setup/teardown test", {
setup: function() {
state = true;
ok(true);
},
teardown: function() {
ok(true);
}
});
test("module with setup/teardown", function() {
expect(3);
ok(true);
});
module("setup/teardown test 2");
test("module without setup/teardown", function() {
expect(1);
ok(true);
});
if (typeof setTimeout !== 'undefined') {
state = 'fail';
module("teardown and stop", {
teardown: function() {
equal(state, "done", "Test teardown.");
}
});
test("teardown must be called after test ended", function() {
expect(1);
stop();
setTimeout(function() {
state = "done";
start();
}, 13);
});
test("parameter passed to stop increments semaphore n times", function() {
expect(1);
stop(3);
setTimeout(function() {
state = "not enough starts";
start(), start();
}, 13);
setTimeout(function() {
state = "done";
start();
}, 15);
});
test("parameter passed to start decrements semaphore n times", function() {
expect(1);
stop(), stop(), stop();
setTimeout(function() {
state = "done";
start(3);
}, 18);
});
module("async setup test", {
setup: function() {
stop();
setTimeout(function(){
ok(true);
start();
}, 500);
}
});
asyncTest("module with async setup", function() {
expect(2);
ok(true);
start();
});
module("async teardown test", {
teardown: function() {
stop();
setTimeout(function(){
ok(true);
start();
}, 500);
}
});
asyncTest("module with async teardown", function() {
expect(2);
ok(true);
start();
});
module("asyncTest");
asyncTest("asyncTest", function() {
expect(2);
ok(true);
setTimeout(function() {
state = "done";
ok(true);
start();
}, 13);
});
asyncTest("asyncTest", 2, function() {
ok(true);
setTimeout(function() {
state = "done";
ok(true);
start();
}, 13);
});
test("sync", 2, function() {
stop();
setTimeout(function() {
ok(true);
start();
}, 13);
stop();
setTimeout(function() {
ok(true);
start();
}, 125);
});
test("test synchronous calls to stop", 2, function() {
stop();
setTimeout(function(){
ok(true, 'first');
start();
stop();
setTimeout(function(){
ok(true, 'second');
start();
}, 150);
}, 150);
});
}
module("save scope", {
setup: function() {
this.foo = "bar";
},
teardown: function() {
deepEqual(this.foo, "bar");
}
});
test("scope check", function() {
expect(2);
deepEqual(this.foo, "bar");
});
module("simple testEnvironment setup", {
foo: "bar",
bugid: "#5311" // example of meta-data
});
test("scope check", function() {
deepEqual(this.foo, "bar");
});
test("modify testEnvironment",function() {
this.foo="hamster";
});
test("testEnvironment reset for next test",function() {
deepEqual(this.foo, "bar");
});
module("testEnvironment with object", {
options:{
recipe:"soup",
ingredients:["hamster","onions"]
}
});
test("scope check", function() {
deepEqual(this.options, {recipe:"soup",ingredients:["hamster","onions"]}) ;
});
test("modify testEnvironment",function() {
// since we do a shallow copy, the testEnvironment can be modified
this.options.ingredients.push("carrots");
});
test("testEnvironment reset for next test",function() {
deepEqual(this.options, {recipe:"soup",ingredients:["hamster","onions","carrots"]}, "Is this a bug or a feature? Could do a deep copy") ;
});
module("testEnvironment tests");
function makeurl() {
var testEnv = QUnit.current_testEnvironment;
var url = testEnv.url || 'http://example.com/search';
var q = testEnv.q || 'a search test';
return url + '?q='+encodeURIComponent(q);
}
test("makeurl working",function() {
equal( QUnit.current_testEnvironment, this, 'The current testEnvironment is global');
equal( makeurl(), 'http://example.com/search?q=a%20search%20test', 'makeurl returns a default url if nothing specified in the testEnvironment');
});
module("testEnvironment with makeurl settings", {
url: 'http://google.com/',
q: 'another_search_test'
});
test("makeurl working with settings from testEnvironment", function() {
equal( makeurl(), 'http://google.com/?q=another_search_test', 'rather than passing arguments, we use test metadata to form the url');
});
test("each test can extend the module testEnvironment", {
q:'hamstersoup'
}, function() {
equal( makeurl(), 'http://google.com/?q=hamstersoup', 'url from module, q from test');
});
module("jsDump");
test("jsDump output", function() {
equals( QUnit.jsDump.parse([1, 2]), "[\n 1,\n 2\n]" );
equals( QUnit.jsDump.parse({top: 5, left: 0}), "{\n \"top\": 5,\n \"left\": 0\n}" );
if (typeof document !== 'undefined' && document.getElementById("qunit-header")) {
equals( QUnit.jsDump.parse(document.getElementById("qunit-header")), "<h1 id=\"qunit-header\"></h1>" );
equals( QUnit.jsDump.parse(document.getElementsByTagName("h1")), "[\n <h1 id=\"qunit-header\"></h1>\n]" );
}
});
module("assertions");
test("raises",function() {
function CustomError( message ) {
this.message = message;
}
CustomError.prototype.toString = function() {
return this.message;
};
raises(
function() {
throw "error"
}
);
raises(
function() {
throw "error"
},
'raises with just a message, no expected'
);
raises(
function() {
throw new CustomError();
},
CustomError,
'raised error is an instance of CustomError'
);
raises(
function() {
throw new CustomError("some error description");
},
/description/,
"raised error message contains 'description'"
);
raises(
function() {
throw new CustomError("some error description");
},
function( err ) {
if ( (err instanceof CustomError) && /description/.test(err) ) {
return true;
}
},
"custom validation function"
);
});
if (typeof document !== "undefined") {
module("fixture");
test("setup", function() {
document.getElementById("qunit-fixture").innerHTML = "foobar";
});
test("basics", function() {
equal( document.getElementById("qunit-fixture").innerHTML, "test markup", "automatically reset" );
});
}
module("custom assertions");
(function() {
function mod2(value, expected, message) {
var actual = value % 2;
QUnit.push(actual == expected, actual, expected, message);
}
test("mod2", function() {
mod2(2, 0, "2 % 2 == 0");
mod2(3, 1, "3 % 2 == 1");
})
})();
module("recursions");
function Wrap(x) {
this.wrap = x;
if (x == undefined) this.first = true;
}
function chainwrap(depth, first, prev) {
depth = depth || 0;
var last = prev || new Wrap();
first = first || last;
if (depth == 1) {
first.wrap = last;
}
if (depth > 1) {
last = chainwrap(depth-1, first, new Wrap(last));
}
return last;
}
test("check jsDump recursion", function() {
expect(4);
var noref = chainwrap(0);
var nodump = QUnit.jsDump.parse(noref);
equal(nodump, '{\n "wrap": undefined,\n "first": true\n}');
var selfref = chainwrap(1);
var selfdump = QUnit.jsDump.parse(selfref);
equal(selfdump, '{\n "wrap": recursion(-1),\n "first": true\n}');
var parentref = chainwrap(2);
var parentdump = QUnit.jsDump.parse(parentref);
equal(parentdump, '{\n "wrap": {\n "wrap": recursion(-2),\n "first": true\n }\n}');
var circref = chainwrap(10);
var circdump = QUnit.jsDump.parse(circref);
ok(new RegExp("recursion\\(-10\\)").test(circdump), "(" +circdump + ") should show -10 recursion level");
});
test("check (deep-)equal recursion", function() {
var noRecursion = chainwrap(0);
equal(noRecursion, noRecursion, "I should be equal to me.");
deepEqual(noRecursion, noRecursion, "... and so in depth.");
var selfref = chainwrap(1);
equal(selfref, selfref, "Even so if I nest myself.");
deepEqual(selfref, selfref, "... into the depth.");
var circref = chainwrap(10);
equal(circref, circref, "Or hide that through some levels of indirection.");
deepEqual(circref, circref, "... and checked on all levels!");
});
test('Circular reference with arrays', function() {
// pure array self-ref
var arr = [];
arr.push(arr);
var arrdump = QUnit.jsDump.parse(arr);
equal(arrdump, '[\n recursion(-1)\n]');
equal(arr, arr[0], 'no endless stack when trying to dump arrays with circular ref');
// mix obj-arr circular ref
var obj = {};
var childarr = [obj];
obj.childarr = childarr;
var objdump = QUnit.jsDump.parse(obj);
var childarrdump = QUnit.jsDump.parse(childarr);
equal(objdump, '{\n "childarr": [\n recursion(-2)\n ]\n}');
equal(childarrdump, '[\n {\n "childarr": recursion(-2)\n }\n]');
equal(obj.childarr, childarr, 'no endless stack when trying to dump array/object mix with circular ref');
equal(childarr[0], obj, 'no endless stack when trying to dump array/object mix with circular ref');
});
test('Circular reference - test reported by soniciq in #105', function() {
var MyObject = function() {};
MyObject.prototype.parent = function(obj) {
if (obj === undefined) { return this._parent; }
this._parent = obj;
};
MyObject.prototype.children = function(obj) {
if (obj === undefined) { return this._children; }
this._children = obj;
};
var a = new MyObject(),
b = new MyObject();
var barr = [b];
a.children(barr);
b.parent(a);
equal(a.children(), barr);
deepEqual(a.children(), [b]);
});
(function() {
var reset = QUnit.reset;
function afterTest() {
ok( false, "reset should not modify test status" );
}
module("reset");
test("reset runs assertions", function() {
QUnit.reset = function() {
afterTest();
reset.apply( this, arguments );
};
});
test("reset runs assertions2", function() {
QUnit.reset = reset;
});
})();
module("noglobals", {
teardown: function() {
delete window.badGlobalVariableIntroducedInTest;
}
});
test("let teardown clean up globals", function() {
// this test will always pass if run without ?noglobals=true
window.badGlobalVariableIntroducedInTest = true;
});

Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais