Comparar commits

..

172 Commits

Autor SHA1 Mensagem Data
Steve Heffernan 442696cfc2 Version 3.0 BETA 2011-09-30 17:28:43 -07:00
Steve Heffernan cab6d3ff48 Changed addListener to addEventListener, to mimic HTML5 API exactly 2011-06-15 17:07:13 -07:00
Steve Heffernan cb4fb10aa9 Started working on an alternative flash method. 2011-06-06 16:08:33 -05:00
Steve Heffernan 992f2ec23c Fixed android check. Added contributor. Updated some docs. 2011-06-06 14:13:10 -05:00
Steve Heffernan 6824c1f1d8 Merge branch 'master' of https://github.com/mbrubeck/video-js into mbrubeck-master 2011-03-24 17:48:07 -07:00
Matt Brubeck 9165097ea1 Stricter test for Android WebKit browsers.
The previous test mistakenly used Android-WebKit-specific code for other
browsers, like Opera and Firefox.
2011-03-23 17:00:56 -07:00
Steve Heffernan bdb9b7a010 Added the VideoJS.player() function for getting a player for an ID 2011-02-23 17:48:19 -08:00
Steve Heffernan 28c66dcf72 Added public src method for changing the video. 2011-02-18 09:33:12 -08:00
Steve Heffernan c8e181be27 Added eirikb to contributors. 2011-02-18 08:56:07 -08:00
Steve Heffernan dacae5717a Merge branch 'master' of https://github.com/eirikb/video-js into eirikb-master 2011-02-18 08:51:09 -08:00
Eirik Brandtzæg 7ffd071823 Refactored from transparent to opaque. Ref comment from emirpprime: https://github.com/eirikb/video-js/commit/59fe0f109beab189243fc6c477921fccd39f0916#commitcomment-275822 2011-02-18 12:16:56 +01:00
Eirik Brandtzæg 59fe0f109b Added <param name="wmode" value="transparent" /> to all instances of <object>. This will help with flash transparency in IE and z-index 2011-02-18 10:06:01 +01:00
Steve Heffernan c6aa3f6421 Updated CSS to put vendor prefixed attributes before non-prefixed ones, to be more future-proof. 2011-02-17 21:32:08 -08:00
Steve Heffernan 88ce51a175 Added listeners for enter/exit full screen/window. 2011-02-17 21:14:11 -08:00
Steve Heffernan f31aec1717 Updated ReadMe 2011-02-17 20:34:53 -08:00
Steve Heffernan d325f6aa56 Added option to disable controls. 2011-02-17 20:32:21 -08:00
Steve Heffernan 069535932c Added strict opacity on hide/show 2011-02-13 15:29:00 -08:00
Steve Heffernan 98a3d991a0 Organized API and files.
Abstracted player API from video API.
Started on Control fading through CSS transitions.
2010-12-29 09:19:09 -08:00
Steve Heffernan 54308bb616 Extracted flash.js. Changed video.js source file to main.js, to avoid confusion. 2010-12-16 13:15:34 -08:00
Steve Heffernan 81aef822db Adding docs.
Changed Video.player to Video.fn (like jQuery), so player can be used to get the player for a video.
2010-12-16 12:55:52 -08:00
Steve Heffernan b97718d177 Rewrote and optimized subtitle code. 2010-12-10 14:53:18 -06:00
Steve Heffernan 6e05cb7082 Moving fullscreen to HTML5 api.
Forcing volume to between 0 and 1.
2010-12-09 15:44:56 -06:00
Steve Heffernan a67cc39c24 Now adding classes of playing/pausing to playToggle elemenets, so they can exist out side of box.
Removed lastSetCurrentTime. Wasn't used.
2010-12-05 17:49:12 -08:00
Steve Heffernan e6b34c516c Allowing ID string for activateElement 2010-12-05 14:42:27 -08:00
Steve Heffernan 4847cd703e Updated readme with fix 2010-12-01 16:24:02 -08:00
Steve Heffernan 451eb22ad6 Added leopard fullscreen fix to source file 2010-12-01 16:21:49 -08:00
Steve Heffernan d18c9082bc Fixed issue with Safari on Leopard (10.5) fullscreen not working. 2010-12-01 16:18:50 -08:00
Steve Heffernan 9fb3f8923e Fixed issue where value & element objects were shared between players. Now defining those vars on init, instead of in prototype. 2010-11-22 16:45:19 -08:00
Steve Heffernan 21a14a7871 Removed console.log 2010-11-22 15:36:10 -08:00
Steve Heffernan 240030fe4d Fix: Issue with big play button when multiple videos are on the page. 2010-11-22 15:35:23 -08:00
Steve Heffernan bc5c1af20a Updated version numbers. 2010-11-22 15:02:11 -08:00
Steve Heffernan 30aa3dfa94 Updated readme with new fixes. 2010-11-22 15:01:21 -08:00
Steve Heffernan e9f23dfe1c Fixed issue with flash fallback no showing in firefox. 2010-11-22 14:59:19 -08:00
Steve Heffernan c9f32ba437 Went back to only tracking current time while playing. Reduced buffer watching interval to reduce load. 2010-11-22 13:38:19 -08:00
Steve Heffernan dd4f79abfd Switched main lib to 2.0. 2010-11-22 09:56:54 -08:00
Steve Heffernan 74f5e85eb4 Added whitespace at the end of each file. 2010-11-21 22:23:22 -08:00
Steve Heffernan 945f370c2b Fixed some IE bugs & some JSlint suggestions. 2010-11-21 22:21:36 -08:00
Steve Heffernan 75742b7d69 Fixed a bug where wouldn't track time after click on scrubber 2010-11-21 20:30:04 -08:00
Steve Heffernan cf40d531ee Fixed issue where links fallback needed an element reference. 2010-11-21 20:18:17 -08:00
Steve Heffernan 3531ab87de Splitting up into development files. Creating v2.0. 2010-11-21 20:14:12 -08:00
Steve Heffernan 45fa3dc45a Created shell script for combining source files. 2010-11-14 14:04:42 -08:00
Steve Heffernan 0274280d66 Broke library into pieces and continued to reorganize. 2010-11-14 11:41:04 -08:00
Steve Heffernan 604b802df8 Added each function.
Updated controlbar to controlbars
2010-11-12 16:23:35 -08:00
Steve Heffernan ef08a3f71b Made flashIsDominant work. 2010-11-12 15:13:54 -08:00
Steve Heffernan c211869e6a Created "Behaviors" and reorgainzed functions based on them. 2010-11-12 15:04:46 -08:00
Steve Heffernan 004fb9ee13 Cleaned up spinner styles. 2010-11-11 19:49:07 -08:00
Steve Heffernan afd350050f Removed option to turn off links because it messes up controls alignment.
Explained some styles.
2010-11-11 19:33:33 -08:00
Steve Heffernan 9fe4307dd3 Updated skins to work with new layout methods. 2010-11-11 18:35:19 -08:00
Steve Heffernan 31f6fcdbd6 Created activateControl method for applying behaviors
Added rEvtContext for creating removable event listeners with context.
Switch to top/left form holygrail for load bar positioning.
Switched to relative/absolute for contorlsBelow instead of JS calculating heights.
Started testing maps integration.
2010-11-11 17:40:22 -08:00
Steve Heffernan 6a682af82c Starting new "Activate" method for controls.
Switched play/pause class on play button to playing/paused class on box, so other elements can style based on that.
2010-11-10 00:05:28 -08:00
Steve Heffernan f59237e0e8 Switched back to divs for controls elements in order to make styles more portable. LIs had too many conflicsts. 2010-11-09 22:41:09 -08:00
Steve Heffernan 7e16988650 Added device specific interfaces. Added play button to Android. Added spinner to iPad.
Catching error on localStorage full that safari seems to randomly throw.
Added check for m3u8.
Tracking warnings.
2010-11-09 21:06:44 -08:00
Steve Heffernan 13455983a8 Fixed iPhone version checking. 2010-11-09 15:15:11 -08:00
Steve Heffernan a7300d5387 Fixed iOS checking 2010-11-09 15:11:52 -08:00
Steve Heffernan d04d330237 Added contributor. 2010-11-09 15:08:54 -08:00
Steve Heffernan 9fcae08b70 Stopped catching errors on player init, because it was causing multiplayers to get started. 2010-11-09 15:04:20 -08:00
Steve Heffernan ff8d052cc3 JSlint fixes. 2010-11-09 14:40:22 -08:00
Steve Heffernan 152c42753c Added versions for skins. 2010-11-09 14:34:59 -08:00
Steve Heffernan bfad8f161e Updated versions and readme. 2010-11-09 14:32:01 -08:00
Steve Heffernan 6d20179ad2 Updated subitles. Now using track element method for setting subitles. 2010-11-08 20:13:43 -08:00
Steve Heffernan 77a48d9324 More reorg.
Switched spinner to use CSS for centering instead of JS.
Created some device checks.
Modularized some device fixes.
2010-11-08 18:44:51 -08:00
Steve Heffernan bea0021b5f Hopefully fixed issue with Android playback.
Fixed issue where big play button would appear over other fullscreen videos.
2010-11-08 13:49:05 -08:00
Steve Heffernan 88cab0ba24 Fixed issue with big button z-index because it was showing over other fullscreen videos. 2010-11-08 08:18:18 -08:00
Steve Heffernan 0abf2e6364 Renamed Controller to ControlBar 2010-11-08 00:08:56 -08:00
Steve Heffernan d15ecf96ff More reorganization. 2010-11-08 00:04:19 -08:00
Steve Heffernan b907b8d1f7 Massive reoganization. 2010-11-07 17:31:33 -08:00
Steve Heffernan 3b9141a1ae Switched to "players" list method for controlling fallbacks and fallback order 2010-11-07 15:30:59 -08:00
Steve Heffernan 1520a55054 Added 1.1.5 changelog 2010-11-07 12:18:30 -08:00
Steve Heffernan 5da3957cca Updated readme. 2010-11-07 12:17:51 -08:00
Steve Heffernan 6303b02119 Updated readme 2010-11-05 18:52:22 -07:00
Steve Heffernan 0ebfa5e068 Added flash ID to readme demo for Flowplayer fix. 2010-11-05 18:15:16 -07:00
Steve Heffernan ea57810e4e Updated to show links if only unplayable sources and no Flash. 2010-11-05 18:03:56 -07:00
Steve Heffernan 864e5bca0c Updated version numbers.
Created test folder.
2010-11-05 17:32:13 -07:00
Steve Heffernan 709e4193b3 Improved styles loaded checking. 2010-11-05 17:11:32 -07:00
Steve Heffernan e8e0306415 Fixed spinner when Safari calls waiting and doesn't resolve. 2010-11-05 16:49:36 -07:00
Steve Heffernan 1138ffae7d Fixed a bug where Chrome shows the poster and plays audio if you set the currentTime too quickly. 2010-11-05 16:13:20 -07:00
Steve Heffernan c8533e4368 Added loading spinner. 2010-11-05 15:53:35 -07:00
Steve Heffernan e9ba8f3792 Added history and logging. 2010-10-21 21:44:58 -07:00
Steve Heffernan 8eedbe6a38 Started spinner 2010-10-21 21:33:00 -07:00
Steve Heffernan c2c945afe5 Added volume() function to get and set volume through the player. 2010-10-20 22:07:38 -07:00
Steve Heffernan c54ad0583b Updated tube skin big play button placement. 2010-10-20 10:21:23 -07:00
Steve Heffernan 761f740c6b Removed test file. 2010-10-19 22:41:58 -07:00
Steve Heffernan f559e36d11 Removed load() from preload fix.
Added big play button styles for other skins.
2010-10-19 22:36:27 -07:00
Steve Heffernan 32193e1e86 Updated readme. Fixed some JSlint complaints. 2010-10-19 21:21:26 -07:00
Steve Heffernan 64e6573945 Added a big play button at the beginning.
Hiding controls at the start because Safari errors if you click fullscreen button before the video loads.
Started error tracking.
Organized controls/box positioning some.
2010-10-18 21:51:02 -07:00
Steve Heffernan 49ffeedd1e Added showPoster to onEnded. So poster shows up when the video ends. 2010-10-04 21:34:36 -07:00
Steve Heffernan 79ef734914 Made initial click & hold trigger new value on progress and volume.
Made controls not hide when hovering over them.
Changed a document.onmousemove to an eventListener to prevent conflicts.
2010-09-25 22:28:04 -07:00
Steve Heffernan 632f929731 Merge branch 'master' of github.com:zencoder/video-js 2010-09-23 10:22:24 -07:00
Steve Heffernan d1754b5a29 Removed vars from global scope. Updated readme. 2010-09-23 10:21:52 -07:00
Fredust85 07545a27ab - removed trailing comma ( IE7 throws exception VideoJS is undefined ) 2010-09-24 01:21:02 +08:00
Steve Heffernan 9cd6ef36fd Added width/height functions to resize the video & player. 2010-09-22 18:41:52 -07:00
Steve Heffernan 54bef3e0d7 Updated readme format again. 2010-09-20 19:08:12 -07:00
Steve Heffernan 848805c94c Updated readme format. 2010-09-20 19:07:12 -07:00
Steve Heffernan 0451dd394a Added iphone/ipad poster fix. Bumped to 1.1.2. 2010-09-20 19:05:17 -07:00
Steve Heffernan 7a4df2780c Added iPhone check. 2010-09-19 11:53:30 -07:00
Steve Heffernan cf20ff7217 Switched to OGV in demo. 2010-09-18 17:50:54 -07:00
Steve Heffernan 7d7d78bfe4 Update contributors. 2010-09-18 09:32:51 -07:00
Steve Heffernan bc1240f8d7 (Shraymonks) Fixed subtitle timings and its interference with showing the controls 2010-09-17 23:29:13 -07:00
Steve Heffernan c72d1ff607 Ran through JSLint and updated based on those suggestions. 2010-09-17 23:19:43 -07:00
Steve Heffernan 644ffb8901 Added more specificity to styles. 2010-09-17 22:12:50 -07:00
Steve Heffernan aeb1744fbf Added contributors list. 2010-09-17 21:11:57 -07:00
Steve Heffernan 843c0a8eb1 Added Android fix thanks to albertogasparin, and organized device fixes. 2010-09-17 21:02:44 -07:00
Steve Heffernan 85e653cebc Uncommented Class 2010-09-17 20:29:02 -07:00
Ken Earley 6b1e929ffd fixing implied global variables 2010-09-18 11:28:36 +08:00
Thomas von Deyen 7e5bd00582 Fix for Flowplayer a-Tag embedding:
Now every HMTL Node with a 'vjs-flash-fallback' className can be the FlashFallback Node.
2010-09-18 11:20:04 +08:00
Steve Heffernan e27c02e32f Switched to .ogv instead of .ogg 2010-09-17 20:19:16 -07:00
Steve Heffernan 62801081d4 First formal version. 2010-09-14 17:24:36 -05:00
Steve Heffernan 886f193f1e Re-enabled native full screen. 2010-09-10 14:35:29 -07:00
Steve Heffernan 20b33afa10 Created a jQuery plugin.
Added the ability to make Flash dominant over HTML5 video.
2010-09-09 19:23:57 -07:00
Steve Heffernan 07019598f1 Removed the videoJSPlayers array, and switched to storing a reference to the player on the video element itself. 2010-09-08 19:11:18 -07:00
Steve Heffernan 833c072ea8 Added a break... 2010-08-19 21:37:19 -07:00
Steve Heffernan 795f2f8a1d Changed setup to include setupAllWhenReady as the main easy way to set up.
Switched setup() to return one or an array of players for referencing later.
Added a bunch to the ReadMe file.
2010-08-19 21:33:30 -07:00
Steve Heffernan 3e8f2db575 Added some CSS updated from Jim Puls 2010-08-19 17:08:46 -07:00
Steve Heffernan c5c645ef6f Updated flowplayer demo to include poster frame. 2010-08-19 15:51:53 -07:00
Steve Heffernan c745b34d4d Added a DOM Ready function, so no library/or onload function needed for basic setup.
Fixed the controls starting at the top and then jumping down issue.
2010-08-06 10:19:23 -07:00
Steve Heffernan 31231d0680 Changed Class to JRClass. Would've conflicted with other libs. 2010-07-26 19:41:28 -07:00
Steve Heffernan 964163aedc Fixe for an apparent play button state issue. 2010-07-21 17:17:42 -07:00
Steve Heffernan 6bd7473f13 Clearing play progress interval before setting it again, just in case. 2010-07-21 17:11:00 -07:00
Steve Heffernan 86e926f94a Changed subtitles to use data-subtitles attribute.
Updated readme.
2010-07-20 16:46:48 -07:00
Steve Heffernan 5efe2b8fa1 Adde subtitle functions by sandaru1 2010-07-20 13:53:06 -07:00
Steve Heffernan 51a10a8e17 Added addVideos function by nicholasbs 2010-07-20 13:39:50 -07:00
Steve Heffernan 63459dfac9 Added subtitles demo file & styles. 2010-07-20 13:39:11 -07:00
Steve Heffernan 01ded669a1 Some organization. 2010-06-27 22:05:35 -07:00
Steve Heffernan 0866dbf3fa Optimized some browser checks. 2010-06-27 21:32:28 -07:00
Steve Heffernan 96c3a29079 Added some optimizations thanks to rabisuz.
Made some additional optimizations and notations to video support checking.
2010-06-27 20:40:00 -07:00
Steve Heffernan 4df3b7a000 Restructured HTML/CSS to make skinning easier.
Added 3 new skins.
Added native fullscreen mode for safari.
2010-06-26 21:48:05 -07:00
Steve Heffernan c0a0c97e0b Organizing CSS 2010-06-17 19:41:27 -07:00
Steve Heffernan 109d473b35 Fixed preloading issue with firefox.
Added links hiding option.
2010-06-17 17:22:36 -07:00
Steve Heffernan 75eb6a7ceb Added back ogg version from testing. 2010-06-15 09:31:37 -07:00
Steve Heffernan 3d6d2154f8 Forcing fallback to flash when source isn't supported 2010-06-15 09:30:20 -07:00
Steve Heffernan 27460d4e46 Moved some functions to _V_ 2010-06-14 19:41:15 -07:00
Steve Heffernan d68a142abb Fixed volume to be more accurate. 2010-06-13 21:59:43 -07:00
Steve Heffernan 159a509962 Added a lot...
Full iPad support.
Source types to embed code.
Source checking ability.
_V_ mock library
2010-06-12 18:00:53 -07:00
Steve Heffernan 3bc2f0ac99 Added buffer watching method for load progress to fix Safari/Chrome 5 2010-06-10 17:42:15 -07:00
Steve Heffernan fc723527ea Comments 2010-06-10 17:05:07 -07:00
Steve Heffernan d76fa8abfe Added esc key for fullscreen mode. 2010-06-10 16:55:56 -07:00
Steve Heffernan 097cdaa14c Added a loading bar. 2010-06-09 01:24:12 -07:00
Steve Heffernan 12c3f34723 Updated readme. 2010-06-08 21:47:27 -07:00
Steve Heffernan 5a35b4627d Removed video ID from video tag. Wasn't needed and isn't right when there are multiple videos. 2010-06-08 19:32:52 -07:00
Steve Heffernan e00aa52d20 Fixed a bug with 2 videos on one page - one video would still overlap the other in full-window mode. 2010-06-08 19:11:28 -07:00
Steve Heffernan 39ab12df70 Added hiding of built in controls if set. Thanks to rabisuz 2010-06-08 18:45:11 -07:00
Steve Heffernan 0aa77ed019 Updated volume storing. Found out Firefox doesn't support it for local files. 2010-06-03 09:55:37 -07:00
Steve Heffernan 7cf324dea1 Switched to CDN 2010-06-03 08:53:27 -07:00
Steve Heffernan f4d5348447 Added download links to round out VfE and compatibility. 2010-06-02 22:03:03 -07:00
Steve Heffernan 65c4ff6f43 Organized some code. Storing volume locally thanks to dz0ny. 2010-06-02 21:25:27 -07:00
Steve Heffernan 72a9aadfbd Organized/updated poster functionality. 2010-06-02 19:44:58 -07:00
Steve Heffernan 6571f38204 Added poster image fix thanks to dz0ny 2010-06-02 19:22:58 -07:00
Janez Troha 47c7d46d99 Usability, showing appropiate curson when over controls. 2010-06-03 07:10:37 +08:00
Janez Troha 1ff9abfc10 Fix for constrols showing in full screen http://github.com/zencoder/video-js/issues#issue/3
Signed-off-by: Janez Troha <janez.troha@gmail.com>
2010-06-03 07:10:37 +08:00
Steve Heffernan 4ee7ccfde4 Updated from autobuffer to preload. Thanks to Bruce Lawson. 2010-06-02 10:52:34 -07:00
Steve Heffernan 95845a7646 Updated license. 2010-06-02 09:08:15 -07:00
Steve Heffernan 877b9d5c8f Separated skin in style sheet. 2010-05-27 15:50:03 -07:00
Steve Heffernan a621aec774 Changed fullscreen back to fixed positioning. 2010-05-27 15:25:10 -07:00
Steve Heffernan d548450e4e Updated to new method of fullscreen to hopefully fix some bugs. 2010-05-27 15:15:33 -07:00
Steve Heffernan b6353669d4 Added support for resizing the window in full-window mode. 2010-05-27 11:40:13 -07:00
Steve Heffernan cd7b1a1493 Added a fix for scrollbars covering the fullwindow button. 2010-05-27 11:07:24 -07:00
Steve Heffernan 0545583730 Fixed a issue with updating the progress bar when the controls are hidden. Thanks to Justin Greer. 2010-05-27 10:51:18 -07:00
Steve Heffernan 46a2340aab Added z-index to prevent anything from being over the video. 2010-05-21 19:48:41 -07:00
Steve Heffernan 8d662f01d8 Reverted to not adding video-js-box dynamically. Was causing weird layout errors. 2010-05-21 09:53:37 -07:00
Steve Heffernan 026f186760 Removed video box in demo because adding it dynamically now.
Switche to window.onload instead of bodyLoaded function.
2010-05-21 09:33:50 -07:00
Steve Heffernan 1d96036ab2 Updated the VFE code.
Reworked some of the listeners to be on the actual video element events.
Added simple auto hiding.
2010-05-21 09:27:47 -07:00
Steve Heffernan c0decf93ec Switched to using a context method for triggered functions.
Fixed a time tracking bug.
2010-05-20 19:19:48 -07:00
Steve Heffernan 4031b8bb57 Updated demo videos.
Added function to dectect video support and not load controls.
2010-05-20 15:48:16 -07:00
Gordon Brander 78993f2005 Added MIT License to package 2010-05-21 00:35:31 +08:00
Steve Heffernan 4695c04a4d Update styles. 2010-05-18 17:55:08 -07:00
Steve Heffernan ffbd81070f Updated player styles. 2010-05-18 10:41:01 -07:00
Steve Heffernan a843541f6c Added setup. 2010-05-17 21:25:32 -07:00
Steve Heffernan 8dd017d892 Added ogg type attribute 2010-05-17 20:37:01 -07:00
Steve Heffernan 79a74350a5 Added Video for Everybody embed code with flowplayer fallback. 2010-05-17 20:36:11 -07:00
Steve Heffernan 5a9b009eb1 Removed the class file 2010-05-17 19:51:45 -07:00
Steve Heffernan abe9252bbb First version. 2010-05-17 19:51:17 -07:00
Brandon Arbini f33b3e519b Initial commit. 2010-05-14 11:50:09 -07:00
119 arquivos alterados com 12946 adições e 2651 exclusões
Ver Arquivo
+153
Ver Arquivo
@@ -0,0 +1,153 @@
VideoJS - [HTML5 Video Player](http://videojs.com)
==================================================
Version 3.0 BETA
---
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.
---
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. 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 VideoJS 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 VideoJS:
1. The 'data-setup' Atrribute tells VideoJS 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 VideoJS 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 for more advanced uses.
Coming Next
-----------
- Stable Release
Changelog
---------
3.0b
- Complete rewrite in progress
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
-104
Ver Arquivo
@@ -1,104 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Comments | HTML5 Video Player | Video JS</title>
<meta name="google-site-verification" content="QHf9MEYVlEWoNHbzTeUkSQsbRT5Twzqu6N0nX1i3nes" />
<script src="video-js/video.js" type="text/javascript" charset="utf-8"></script>
<!-- JQuery not required, but used for dom ready function -->
<script src="javascripts/jquery-1.4.2.min.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="stylesheets/base.css" type="text/css" media="all" charset="utf-8" />
<link rel="stylesheet" href="video-js/video-js.css" type="text/css" media="all" charset="utf-8" />
<link rel="stylesheet" href="stylesheets/site.css" type="text/css" media="all" charset="utf-8" />
<!--[if !IE 7]>
<style type="text/css">
#wrap {display:table;height:100%}
</style>
<![endif]-->
<script type="text/javascript" charset="utf-8">
// Using JQuery's DOM Ready function
// You can also use window.onload, but it loads slower
$(function(){
VideoJS.setup();
})
// If not using a JS library
// window.onload = function(){
// VideoJS.setup();
// }
</script>
</head>
<body>
<div id="wrap">
<div id="main">
<ul id="nav">
<li><a href="skins.html">Skins</a></li>
<li><a href="http://github.com/zencoder/video-js">Source</a></li>
<li><a href="http://wiki.github.com/zencoder/video-js/browser-device-compatibility">Compatibility</a></li>
<li><a href="http://github.com/zencoder/video-js/issues">Issue Tracker</a></li>
<li><a href="http://wiki.github.com/zencoder/video-js/">Wiki</a></li>
</ul>
<h1>Video JS</h1>
<p class="tagline">Open Source HTML5 Video Player</p>
<div id="disqus_thread"></div>
<script type="text/javascript">
/**
* var disqus_identifier; [Optional but recommended: Define a unique identifier (e.g. post id or slug) for this thread]
*/
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://videojs.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript=videojs">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
</div>
</div>
<div id="footer">
&copy; <a href="http://videojs.com">The Video JS Project</a>. Sponsored by <a href="http://zencoder.com">Zencoder</a>.
</div>
</div>
<script type="text/javascript">
//<![CDATA[
(function() {
var links = document.getElementsByTagName('a');
var query = '?';
for(var i = 0; i < links.length; i++) {
if(links[i].href.indexOf('#disqus_thread') >= 0) {
query += 'url' + i + '=' + encodeURIComponent(links[i].href) + '&';
}
}
document.write('<script charset="utf-8" type="text/javascript" src="http://disqus.com/forums/videojs/get_num_replies.js' + query + '"></' + 'script>');
})();
//]]>
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-16505296-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>
+22
Ver Arquivo
@@ -0,0 +1,22 @@
<!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'>
</video>
</body>
</html>
Arquivo executável
+36
Ver Arquivo
@@ -0,0 +1,36 @@
#! /bin/csh
# Combines Source Files. In terminal, sh combine_sources.sh
# It will put a new video.js file under dist/
cat ../src/_begin.js > ../dist/video.js
cat ../src/core.js >> ../dist/video.js
cat ../src/api.js >> ../dist/video.js
cat ../src/lib.js >> ../dist/video.js
cat ../src/log.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/tracks.js >> ../dist/video.js
cat ../src/tech/html5.js >> ../dist/video.js
cat ../src/tech/flowplayer.js >> ../dist/video.js
# h5swf temporarily requires swfobject
cat ../src/tech/h5swf.js >> ../dist/video.js
cat ../flash/swfobject.js >> ../dist/video.js
cat ../src/behaviors/behaviors.js >> ../dist/video.js
cat ../src/behaviors/seekBar.js >> ../dist/video.js
cat ../src/behaviors/texttrackdisplays.js >> ../dist/video.js
cat ../src/behaviors/volume.js >> ../dist/video.js
cat ../src/controls/bar.js >> ../dist/video.js
cat ../src/controls/bigPlay.js >> ../dist/video.js
cat ../src/controls/subtitlesBox.js >> ../dist/video.js
cat ../src/autoload.js >> ../dist/video.js
cat ../src/_end.js >> ../dist/video.js
+6
Ver Arquivo
@@ -0,0 +1,6 @@
body { font-size: 11px; font-family: 'Helvetica Neue', helvetica, arial; }
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; }
+102
Ver Arquivo
@@ -0,0 +1,102 @@
<!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" type="text/javascript" charset="utf-8"></script>
<script src="../src/lib.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/ecma.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/json.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/api.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/events.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/tracks.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/behaviors/behaviors.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/behaviors/seekBar.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/behaviors/volume.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/behaviors/texttrackdisplays.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/controls/bigPlay.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/controls/bar.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/controls/subtitlesBox.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/tech/html5.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/tech/flowplayer.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/autoload.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/log.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/tech/h5swf.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="../flash/swfobject.js"></script>
<link rel="stylesheet" href="compare.css" type="text/css">
<script type="text/javascript" src="compare.js"></script>
</head>
<body>
<table border="0" cellspacing="5" cellpadding="5">
<tr><th colspan="2">HTML5</th><th colspan="2">H5Swf</th><th colspan="2">Flowplayer</th></tr>
<tr>
<td colspan="2">
<video id="vid1" class="video-js vjs-default-skin" preload="auto" width="480" height="198">
<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" preload="auto" width="480" height="198">
<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="vid3" class="video-js vjs-default-skin" preload="auto" width="480" height="198">
<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="h5swf_props" border="0" cellspacing="0" cellpadding="0"></table>
</td>
<td class="info-col">
<div id="h5swf_events"></div>
</td>
<td class="info-col">
<table id="flowplayer_props" border="0" cellspacing="0" cellpadding="0"></table>
</td>
<td class="info-col">
<div id="flowplayer_events"></div>
</td>
</tr>
</table>
</body>
</html>
+55
Ver Arquivo
@@ -0,0 +1,55 @@
$(function(){
var tech, i,
techList = ["html5","h5swf","flowplayer"],
props = "error,currentSrc,networkState,buffered,readyState,seeking,initialTime,duration,startOffsetTime,paused,played,seekable,ended,videoWidth,videoHeight,textTracks,preload,currentTime,playbackRate,autoplay,loop,controls,volume,muted,defaultMuted".split(","),
methods = "play,pause,src,load,canPlayType,addTextTrack",
notUsed = "mediaGroup,controller,videoTracks,audioTracks,defaultPlaybackRate";
for (i=0; i < techList.length; i++) {
tech = techList[i];
var player = _V_("vid"+(i+1), { "techOrder":[tech] });
_V_.each(_V_.html5Events, function(evt){
player.addEvent(evt, _V_.proxy(tech, 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 = $("#"+tech+"_props");
_V_.each(props, function(prop){
propTable.append("<tr><th>"+prop+"</th><td id='"+tech+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") {
result = (result.length > 0) ? "s:"+result.start(0)+" e:"+result.end(0) : "-";
}
} catch(e) {
result = "<span class='na'>N/A</span>";
}
$("#"+this.currentTechName+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.
+13
Ver Arquivo
@@ -0,0 +1,13 @@
1
00:00:00,000 --> 00:00:07,200
[Background Music Playing]
2
00:00:16,000 --> 00:00:17,200
Welcome to this week's episode
3
00:00:17,400 --> 00:00:19,000
of explore California
Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 85 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);
}
+307
Ver Arquivo
@@ -0,0 +1,307 @@
/*
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;
}
/* 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) */
}
/* Subtiles Style */
.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)
================================================================================
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: block; /* 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, left top, left bottom, 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; background: #666; cursor: pointer !important;
-moz-border-radius: 0.3em; -webkit-border-radius: 0.3em; border-radius: 0.3em;
background: #333;
background: -moz-linear-gradient(top, #333 0%, #666 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#333), color-stop(100%,#666));
background: -webkit-linear-gradient(top, #333 0%,#666 100%);
background: -o-linear-gradient(top, #333 0%,#666 100%);
background: -ms-linear-gradient(top, #333 0%,#666 100%);
background: linear-gradient(top, #333 0%,#666 100%);
}
.vjs-default-skin .vjs-volume-level {
position: absolute; top: 0; left: 0; height: 0.6em; background: #fff;
-moz-border-radius: 0.3em; -webkit-border-radius: 0.3em; border-radius: 0.3em;
background: #ffffff;
background: -moz-linear-gradient(top, #ffffff 0%, #cccccc 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#cccccc));
background: -webkit-linear-gradient(top, #ffffff 0%,#cccccc 100%);
background: -o-linear-gradient(top, #ffffff 0%,#cccccc 100%);
background: -ms-linear-gradient(top, #ffffff 0%,#cccccc 100%);
background: linear-gradient(top, #ffffff 0%,#cccccc 100%);
}
.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, #333 0%, #222 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#222), color-stop(100%,#333));
background: -webkit-linear-gradient(top, #222 0%,#333 100%);
background: -o-linear-gradient(top, #333 0%,#222 100%);
background: -ms-linear-gradient(top, #333 0%,#222 100%);
background: linear-gradient(top, #333 0%,#222 100%);
/* 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 0%, #262626 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#111), color-stop(100%,#262626));
background: -webkit-linear-gradient(top, #111 0%,#262626 100%);
background: -o-linear-gradient(top, #111 0%,#262626 100%);
background: -ms-linear-gradient(top, #111 0%,#262626 100%);
background: linear-gradient(top, #111 0%,#262626 100%);
}
.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, left top, left bottom, 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, left top, left bottom, 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 0%, #333 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#666), color-stop(100%,#333));
background: -webkit-linear-gradient(top, #666 0%,#333 100%);
background: -o-linear-gradient(top, #666 0%,#333 100%);
background: -ms-linear-gradient(top, #666 0%,#333 100%);
background: linear-gradient(top, #666 0%,#333 100%);
}
.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') 0px -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: 0px 2px 4px 0px #000; -moz-box-shadow: 0px 2px 4px 0px #000; box-shadow: 0px 2px 4px 0px #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 0%, #333 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#222), color-stop(100%,#333));
background: -webkit-linear-gradient(top, #222 0%,#333 100%);
background: -o-linear-gradient(top, #333 0%,#222 100%);
background: -ms-linear-gradient(top, #333 0%,#222 100%);
background: linear-gradient(top, #333 0%,#222 100%);
/* 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, left top, left bottom, 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: 0px 0px 80px #fff; -moz-box-shadow: 0px 0px 80px #fff; box-shadow: 0px 0px 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;
}
Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 7.3 KiB

+62
Ver Arquivo
@@ -0,0 +1,62 @@
<!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="dist/video.js"></script> -->
<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/log.js"></script>
<script src="src/api.js"></script>
<script src="src/events.js"></script>
<script src="src/tracks.js"></script>
<script src="src/behaviors/behaviors.js"></script>
<script src="src/behaviors/seekBar.js"></script>
<script src="src/behaviors/volume.js"></script>
<script src="src/behaviors/texttrackdisplays.js"></script>
<script src="src/controls/bigPlay.js"></script>
<script src="src/controls/bar.js"></script>
<script src="src/controls/subtitlesBox.js"></script>
<script src="src/tech/html5.js"></script>
<script src="src/tech/flowplayer.js"></script>
<script src="src/tech/h5swf.js"></script>
<script src="src/autoload.js"></script>
<script type="text/javascript" src="flash/swfobject.js"></script>
</head>
<body>
<video id="vid1" class="video-js vjs-default-skin" controls preload="none" width="640" height="264" data-setup='{"example_option":true}' poster="http://video-js.zencoder.com/oceans-clip.png">
<!-- <source src="http://pseudo01.hddn.com/vod/demo.flowplayervod/flowplayer-700.flv" type='video/flv'> -->
<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://stg.video.howcookingworks.com/video/posts/e110d95f6770c62e8d3ba52ff221e7f7907683ac266939/e110d95f6770c62e8d3ba52ff221e7f7907683ac266939_high.webm" type='video/webm'> -->
<source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg; codecs="theora, vorbis"'>
<!-- <track kind="subtitles" src="http://videojs.com/subtitles/demo-subtitles.srt" srclang="en-US" label="English"></track> -->
<!-- <track kind="subtitles" src="demo-subtitles.srt" srclang="en-US" label="English"></track> -->
</video>
<script>
// vid = document.getElementById("vid2");
</script>
</body>
</html>
Arquivo binário não exibido.
Diff do arquivo suprimido porque uma ou mais linhas são muito longas
+4
Ver Arquivo
@@ -0,0 +1,4 @@
// Self-executing function to prevent global vars and help with minification
;(function(window, undefined){
var document = window.document;
+6
Ver Arquivo
@@ -0,0 +1,6 @@
// Expose to global
window.VideoJS = window._V_ = VideoJS;
// End self-executing function
})(window);
+294
Ver Arquivo
@@ -0,0 +1,294 @@
/* Player API
================================================================================ */
VideoJS.fn.extend({
apiCall: function(method, arg){
if (this.isReady) {
if (this.api[method]) {
return this.api[method].call(this, arg);
} else {
throw new Error("The '"+method+"' method is not available on the playback technology's API");
}
} else {
throw new Error("The playback technology API is not ready yet. Use player.ready(myFunction).");
}
},
/* Listener types: play, pause, timeupdate, bufferedupdate, ended, volumechange, error */
addEvent: function(type, fn){
return _V_.addEvent(this.box, type, _V_.proxy(this, fn));
},
removeEvent: function(type, fn){
return _V_.removeEvent(this.box, type, fn);
},
triggerEvent: function(type, e){
return _V_.triggerEvent(this.box, type, e);
},
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) {
this.values.currentTime = seconds; // Cache the last set value for smoother scrubbing.
this.apiCall("setCurrentTime", seconds);
if (this.manualTimeUpdates) { this.triggerEvent("timeupdate"); }
return this;
}
return 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);
this.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.box.width = width;
this.box.style.width = width+"px";
if (!skipListeners) { this.triggerEvent("resize"); }
return this;
}
return parseInt(this.box.getAttribute("width"));
},
height: function(height){
if (height !== undefined) {
this.box.height = height;
this.box.style.height = height+"px";
this.triggerEvent("resize");
return this;
}
return parseInt(this.box.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
enterFullScreen: function(){
if (false && this.supportsFullScreen()) {
this.api("enterFullScreen");
} else {
this.enterFullWindow();
}
this.triggerEvent("enterFullScreen");
return this;
},
exitFullScreen: function(){
if (true || !this.supportsFullScreen()) {
this.exitFullWindow();
}
this.triggerEvent("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_.addEvent(document, "keydown", _V_.proxy(this, this.fullscreenOnEscKey));
// Add listener for a window resize
_V_.addEvent(window, "resize", _V_.proxy(this, this.fullscreenOnWindowResize));
// Hide any scroll bars
document.documentElement.style.overflow = 'hidden';
// Apply fullscreen styles
_V_.addClass(document.body, "vjs-full-window");
_V_.addClass(this.box, "vjs-fullscreen");
this.triggerEvent("enterFullWindow");
},
exitFullWindow: function(){
this.videoIsFullScreen = false;
_V_.removeEvent(document, "keydown", this.fullscreenOnEscKey);
_V_.removeEvent(window, "resize", this.fullscreenOnWindowResize);
// Unhide scroll bars.
document.documentElement.style.overflow = this.docOrigOverflow;
// Remove fullscreen styles
_V_.removeClass(document.body, "vjs-full-window");
_V_.removeClass(this.box, "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) {
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_.tech[techName];
// Check if the browser supports this technology
if (tech.supported()) {
// Loop through each source object
for (var a=0,b=this.options.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) {
this.src(source.src);
// Case: URL String (http://myvideo...)
} else {
this.apiCall("src", source);
this.load();
}
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; },
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"); }
});
+37
Ver Arquivo
@@ -0,0 +1,37 @@
_V_.loadPlayers = function(){
var vids = document.getElementsByTagName("video"),
options, vid;
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) {
// Check if this video has already been set up by video.js.
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.
VideoJS.players[vid.id] = new VideoJS(vid, options);
}
}
// If getAttribute isn't defined, we need to wait for the DOM.
} else {
_V_.loadPlayerTimeout(1);
break;
}
}
} else {
_V_.loadPlayerTimeout(1);
}
};
_V_.loadPlayerTimeout = function(wait){
setTimeout(_V_.loadPlayers, wait);
};
_V_.loadPlayerTimeout(1); // Let vjs javascript finish executing
+310
Ver Arquivo
@@ -0,0 +1,310 @@
/* Box Behaviors - The primary container element
================================================================================ */
VideoJS.fn.newBehavior("box",
function(element){
_V_.addClass(element, "vjs-paused");
this.addEvent("play", this.boxOnVideoPlay);
this.addEvent("pause", this.boxOnVideoPause);
},
function(){},
{
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");
}
}
);
/* Playback Technology Element Behaviors
================================================================================ */
VideoJS.fn.newBehavior("tech",
function(element){
_V_.addEvent(element, "click", _V_.proxy(this, this.onPlayToggleClick));
},
function(element){
_V_.removeEvent(element, "click", this.onPlayToggleClick);
},
{}
);
/* Control Bar Behaviors
================================================================================ */
VideoJS.fn.newBehavior("controlBar",
function(element){
if (!this.bels.controlBars) {
this.bels.controlBars = [];
// this.addEvent("mouseover", this.showControlBars);
// this.addEvent("mouseout", this.hideControlBars);
}
this.bels.controlBars.push(element);
},
function(element){},
{
showControlBars: function(){
this.each(this.bels.controlBars, function(bar){
bar.style.opacity = 1;
// bar.style.display = "block";
});
},
hideControlBars: function(){
this.each(this.bels.controlBars, function(bar){
bar.style.opacity = 0;
// bar.style.display = "none";
});
}
}
);
/* PlayToggle, PlayButton, PauseButton Behaviors
================================================================================ */
// Play Toggle
VideoJS.fn.newBehavior("playToggle", function(element){
if (!this.bels.playToggles) {
this.bels.playToggles = [];
this.addEvent("play", this.playTogglesOnPlay);
this.addEvent("pause", this.playTogglesOnPause);
}
this.bels.playToggles.push(element);
_V_.addEvent(element, "click", _V_.proxy(this, this.onPlayToggleClick));
_V_.addEvent(element, "focus", _V_.proxy(this, this.onPlayToggleFocus));
_V_.addEvent(element, "blur", _V_.proxy(this, this.onPlayToggleBlur));
},
function(){},
{
onPlayToggleClick: function(event){
if (this.paused()) {
this.play();
} else {
this.pause();
}
},
playTogglesOnPlay: function(event){
this.each(this.bels.playToggles, function(toggle){
_V_.removeClass(toggle, "vjs-paused");
_V_.addClass(toggle, "vjs-playing");
});
},
playTogglesOnPause: function(event){
this.each(this.bels.playToggles, function(toggle){
_V_.removeClass(toggle, "vjs-playing");
_V_.addClass(toggle, "vjs-paused");
});
},
onPlayToggleFocus: function(event){
_V_.addEvent(document, "keyup", _V_.proxy(this, this.onPlayToggleKey));
},
onPlayToggleKey: function(event){
if (event.which == 32 || event.which == 13) {
event.preventDefault();
this.onPlayToggleClick();
}
},
onPlayToggleBlur: function(event){
_V_.removeEvent(document, "keyup", _V_.proxy(this, this.onPlayToggleKey));
}
}
);
// Play
VideoJS.fn.newBehavior("playButton", function(element){
_V_.addEvent(element, "click", _V_.proxy(this, this.onPlayButtonClick));
},
function(){},
{
onPlayButtonClick: function(event){ this.play(); }
}
);
// Pause
VideoJS.fn.newBehavior("pauseButton", function(element){
_V_.addEvent(element, "click", _V_.proxy(this, this.onPauseButtonClick));
},
function(){},
{
onPauseButtonClick: function(event){ this.pause(); }
}
);
/* Current Time Display Behaviors
================================================================================ */
VideoJS.fn.newBehavior("currentTimeDisplay", function(element){
if (!this.bels.currentTimeDisplays) {
this.bels.currentTimeDisplays = [];
this.addEvent("timeupdate", this.updateCurrentTimeDisplays);
}
this.bels.currentTimeDisplays.push(element);
},
function(){},
{
// 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.bels.currentTimeDisplays, function(dis){
dis.innerHTML = _V_.formatTime(time, this.duration());
});
}
}
);
/* Duration Display Behaviors
================================================================================ */
VideoJS.fn.newBehavior("durationDisplay", function(element){
if (!this.bels.durationDisplays) {
this.bels.durationDisplays = [];
this.addEvent("timeupdate", this.updateDurationDisplays);
}
this.bels.durationDisplays.push(element);
},
function(){},
{
updateDurationDisplays: function(){
this.each(this.bels.durationDisplays, function(dis){
if (this.duration()) { dis.innerHTML = _V_.formatTime(this.duration()); }
});
}
}
);
/* Duration Display Behaviors
================================================================================ */
VideoJS.fn.newBehavior("remainingTimeDisplay", function(element){
if (!this.bels.remainingTimeDisplays) {
this.bels.remainingTimeDisplays = [];
this.addEvent("timeupdate", this.updateRemainingTimeDisplays);
}
this.bels.remainingTimeDisplays.push(element);
},
function(){},
{
updateRemainingTimeDisplays: function(){
this.each(this.bels.remainingTimeDisplays, function(dis){
if (this.duration()) { dis.innerHTML = "-"+_V_.formatTime(this.remainingTime()); }
});
}
}
);
/* Time Left (remaining) Display Behaviors
================================================================================ */
VideoJS.fn.newBehavior("timeLeftDisplay", function(element){
if (!this.bels.timeLeftDisplays) {
this.bels.timeLeftDisplays = [];
this.addEvent("timeupdate", this.updateTimeLeftDisplays);
}
this.bels.timeLeftDisplays.push(element);
},
function(){
this.removeEvent("timeupdate", this.updateTimeLeftDisplays);
delete this.bels.timeLeftDisplays;
},
{
updateTimeLeftDisplays: function(){
// Allows for smooth scrubbing, when player can't keep up.
var time = (this.scrubbing) ? this.values.currentTime : this.currentTime();
this.each(this.bels.timeLeftDisplays, function(dis){
dis.innerHTML = "-" + _V_.formatTime(this.duration() - time);
});
}
}
);
/* Volume Scrubber Behaviors
================================================================================ */
VideoJS.fn.newBehavior("volumeScrubber", function(element){
// Binding with element as 'this' so the progress holder element can be retrieved in IE.
// IE doesn't support the currentTarget event attr.
var player = this;
_V_.addEvent(element, "mousedown", _V_.proxy(element, function(e){
player.onVolumeScrubberMouseDown(e, this);
}));
},
function(){},
{
// 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_.addEvent(document, "mousemove", _V_.proxy(this, this.onVolumeScrubberMouseMove));
_V_.addEvent(document, "mouseup", _V_.proxy(this, this.onVolumeScrubberMouseUp));
},
onVolumeScrubberMouseMove: function(event){
this.setVolumeWithScrubber(event);
},
onVolumeScrubberMouseUp: function(event){
this.setVolumeWithScrubber(event);
_V_.unblockTextSelection();
_V_.removeEvent(document, "mousemove", this.onVolumeScrubberMouseMove, false);
_V_.removeEvent(document, "mouseup", this.onVolumeScrubberMouseUp, false);
},
setVolumeWithScrubber: function(event){
var newVol = _V_.getRelativePosition(event.pageX, this.currentScrubber);
this.volume(newVol);
}
}
);
/* Volume Display Behaviors
================================================================================ */
VideoJS.fn.newBehavior("volumeDisplay", function(element){
if (!this.bels.volumeDisplays) {
this.bels.volumeDisplays = [];
this.addEvent("volumechange", this.updateVolumeDisplays);
}
this.bels.volumeDisplays.push(element);
this.updateVolumeDisplay(element); // Set the display to the initial volume
},
function(){},
{
// Update the volume control display
// Unique to these default controls. Uses borders to create the look of bars.
updateVolumeDisplays: function(){
if (!this.bels.volumeDisplays) { return; }
this.each(this.bels.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");
}
});
}
}
);
/* Fullscreen Toggle Behaviors
================================================================================ */
VideoJS.fn.newBehavior("fullscreenToggle", function(element){
_V_.addEvent(element, "click", _V_.proxy(this, this.onFullscreenToggleClick));
},
function(){},
{
// 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();
}
}
}
);
+213
Ver Arquivo
@@ -0,0 +1,213 @@
/* Seek Bar Behaviors (Current Time Scrubber)
================================================================================ */
VideoJS.fn.newBehavior("seekBar",
function(element){
if (!this.bels.seekBars) {
this.bels.seekBars = [];
this.addEvent("timeupdate", this.updateSeekBars);
}
this.bels.seekBars.push(element);
// Get and store related child objects (progress bar & handle)
var data = _V_.getData(element);
this.each(element.childNodes, function(c){
if (c.className) {
if (c.className.indexOf("seek-handle") != -1) {
data.seekHandle = c;
} else if (c.className.indexOf("play-progress") != -1) {
data.playProgress = c;
}
}
});
// Binding with element as 'this' so the progress holder element can be retrieved in IE.
// IE doesn't support the currentTarget event attr.
var player = this;
_V_.addEvent(element, "mousedown", _V_.proxy(element, function(event){
player.onSeekBarMouseDown(event, this);
}));
_V_.addEvent(element, "focus", _V_.proxy(this, this.onSeekBarFocus));
_V_.addEvent(element, "blur", _V_.proxy(this, this.onSeekBarBlur));
},
function(){},
{
// Adjust the play position when the user drags on the progress bar
onSeekBarMouseDown: function(event, currentTarget){
event.preventDefault();
_V_.blockTextSelection();
this.currSeekBar = currentTarget;
this.currHandle = _V_.getData(currentTarget).seekHandle || false;
this.scrubbing = true;
this.videoWasPlaying = !this.paused();
this.pause();
this.setCurrentTimeWithScrubber(event);
_V_.addEvent(document, "mousemove", _V_.proxy(this, this.onSeekBarMouseMove));
_V_.addEvent(document, "mouseup", _V_.proxy(this, this.onSeekBarMouseUp));
},
onSeekBarMouseMove: function(event){ // Removeable
this.setCurrentTimeWithScrubber(event);
},
onSeekBarMouseUp: function(event){ // Removeable
_V_.unblockTextSelection();
_V_.removeEvent(document, "mousemove", this.onSeekBarMouseMove, false);
_V_.removeEvent(document, "mouseup", this.onSeekBarMouseUp, false);
this.scrubbing = false;
if (this.videoWasPlaying) {
this.play();
}
},
setCurrentTimeWithScrubber: function(event){
var bar = this.currSeekBar,
barX = _V_.findPosX(bar),
barW = bar.offsetWidth,
handle = this.currHandle,
handleW = (handle) ? handle.offsetWidth : 0;
// Adjusted X and Width, so handle doesn't go outside the bar
barAX = barX + (handleW / 2),
barAW = barW - handleW,
// Percent that the click is through the adjusted area
percent = Math.max(0, Math.min(1, (event.pageX - barAX) / barAW)),
// Percent translated to pixels
percentPix = percent * barAW,
// Percent translated to seconds
newTime = percent * this.duration();
// Don't let video end while scrubbing.
if (newTime == this.duration()) { newTime = newTime - 0.1; }
// Set new time (tell player to seek to new time)
this.currentTime(newTime);
},
getSeekBarAdjustedWidth: function(bar, handle){
var bar = this.currSeekBar,
barX = _V_.findPosX(bar),
barW = bar.offsetWidth,
handle = this.currHandle,
handleW = (handle) ? handle.offsetWidth : 0;
// Adjusted X and Width, so handle doesn't go outside the bar
barAX = barX + (handleW / 2),
barAW = barW - handleW;
},
updateSeekBars: function(){
// If scrubbing, use the cached currentTime value for speed
var progress = /* (this.scrubbing) ? this.scrubTime / this.duration() : */ this.currentTime() / this.duration();
// Protect against no duration and other division issues
if (isNaN(progress)) { progress = 0; }
this.each(this.bels.seekBars, function(bar){
var barData = _V_.getData(bar),
barX = _V_.findPosX(bar),
barW = bar.offsetWidth,
handle = barData.seekHandle,
progBar = barData.playProgress,
handleW = (handle) ? handle.offsetWidth : 0;
// Adjusted X and Width, so handle doesn't go outside the bar
barAX = barX + (handleW / 2),
barAW = barW - handleW;
// Percent that the click is through the adjusted area
// percent = Math.max(0, Math.min(1, (event.pageX - barAX) / barAW)),
// Percent translated to pixels
// percentPix = percent * barAW,
// Percent translated to seconds
// newTime = percent * this.duration();
progBarProgress = _V_.round(progress * barAW + handleW / 2) + "px";
if (progBar && progBar.style) { progBar.style.width = progBarProgress; }
handle.style.left = _V_.round(progress * barAW)+"px";
});
// Update bar length
// this.each(this.bels.playProgressBars, function(bar){
// if (bar.style) { bar.style.width = _V_.round(progress * 100, 2) + "%"; }
// });
// Move Handle
},
onSeekBarFocus: function(event){
_V_.addEvent(document, "keyup", _V_.proxy(this, this.onSeekBarKey));
},
onSeekBarKey: function(event){
if (event.which == 37) {
event.preventDefault();
this.currentTime(this.currentTime() - 1);
} else if (event.which == 39) {
event.preventDefault();
this.currentTime(this.currentTime() + 1);
}
},
onSeekBarBlur: function(event){
_V_.removeEvent(document, "keyup", _V_.proxy(this, this.onSeekBarKey));
}
}
);
/* Seek Handle Behaviors
================================================================================ */
VideoJS.fn.newBehavior("seekHandle",
function(element){
if (!this.bels.seekHandles) { this.bels.seekHandles = []; }
this.bels.seekHandles.push(element);
// Store references between seekbar and seekhandle
_V_.getData(element).seekBar = element.parentNode;
_V_.getData(element.parentNode).seekHandle = element;
},
function(){},
{}
);
/* Play Progress Bar Behaviors
================================================================================ */
VideoJS.fn.newBehavior("playProgressBar",
function(element){
if (!this.bels.playProgressBars) {
this.bels.playProgressBars = [];
this.addEvent("timeupdate", this.updatePlayProgressBars);
}
this.bels.playProgressBars.push(element);
},
function(){
// Remove
},
{
// Ajust the play progress bar's width based on the current play time
updatePlayProgressBars: function(){
// If scrubbing, use the cached currentTime value for speed
var progress = (this.scrubbing) ? this.values.currentTime / this.duration() : this.currentTime() / this.duration();
// Protect against no duration and other division issues
if (isNaN(progress)) { progress = 0; }
// Update bar length
this.each(this.bels.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.bels.loadProgressBars) { this.bels.loadProgressBars = []; }
this.bels.loadProgressBars.push(element);
this.addEvent("progress", this.updateLoadProgressBars);
},
function(){},
{
updateLoadProgressBars: function(event){
// log("updating progress bars", this.bufferedPercent());
this.each(this.bels.loadProgressBars, function(bar){
if (bar.style) { bar.style.width = _V_.round(this.bufferedPercent() * 100, 2) + "%"; }
});
}
}
);
+43
Ver Arquivo
@@ -0,0 +1,43 @@
/* 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.
_V_.each(["subtitles", "captions", "chapters", "descriptions"], function(type){
var add, remove,
name = type+"Display",
plural = name+"s",
updateFuncName = "update"+plural,
funcs = {};
// Add the behavior to an element
add = function(element){
if (!this.bels[plural]) {
this.bels[plural] = [];
this.addEvent(type+"update", this[updateFuncName]);
}
this.bels[plural].push(element);
};
// Remove the behavior from an element
remove = function(element){
if (this.bels[plural]) {
_V_.remove(element, this.bels[plural]);
if (this.bels[plural].length == 0) {
this.removeEvent(type+"update", this[updateFuncName]);
delete this.bels[plural];
}
}
};
// Addional needed funcitons (added directly to player)
funcs[updateFuncName] = function(){
var val = this.textTrackValue(type);
this.each(this.bels[plural], function(display){
display.innerHTML = val;
});
};
VideoJS.fn.newBehavior(name, add, remove, funcs);
});
+177
Ver Arquivo
@@ -0,0 +1,177 @@
/* Volume Behaviors
================================================================================ */
/* Seek Bar Behaviors (Current Time Scrubber)
================================================================================ */
VideoJS.fn.newBehavior("volumeBar",
function(element){
if (!this.bels.volumeBars) {
this.bels.volumeBars = [];
this.addEvent("volumechange", this.updateVolumeBars);
}
this.bels.volumeBars.push(element);
// Get and store related child objects (level & handle)
var data = _V_.getData(element);
this.each(element.childNodes, function(c){
if (c.className) {
if (c.className.indexOf("volume-handle") != -1) {
data.volumeHandle = c;
} else if (c.className.indexOf("volume-level") != -1) {
data.volumeLevel = c;
}
}
});
// Binding with element as 'this' so the holder element can be retrieved in IE.
// IE doesn't support the currentTarget event attr.
var player = this;
_V_.addEvent(element, "mousedown", _V_.proxy(element, function(event){
player.onVolumeBarMouseDown(event, this);
}));
// _V_.addEvent(element, "focus", _V_.proxy(this, this.onVolumeBarFocus));
// _V_.addEvent(element, "blur", _V_.proxy(this, this.onVolumeBarBlur));
},
function(){},
{
// Adjust the play position when the user drags on the progress bar
onVolumeBarMouseDown: function(event, currentTarget){
event.preventDefault();
_V_.blockTextSelection();
this.currVolumeBar = currentTarget;
this.currHandle = _V_.getData(currentTarget).volumeHandle || false;
this.setVolumeWithSlider(event);
_V_.addEvent(document, "mousemove", _V_.proxy(this, this.onVolumeBarMouseMove));
_V_.addEvent(document, "mouseup", _V_.proxy(this, this.onVolumeBarMouseUp));
},
onVolumeBarMouseMove: function(event){ // Removeable
this.setVolumeWithSlider(event);
},
onVolumeBarMouseUp: function(event){ // Removeable
_V_.unblockTextSelection();
_V_.removeEvent(document, "mousemove", this.onVolumeBarMouseMove, false);
_V_.removeEvent(document, "mouseup", this.onVolumeBarMouseUp, false);
},
setVolumeWithSlider: function(event){
var bar = this.currVolumeBar,
barX = _V_.findPosX(bar),
barW = bar.offsetWidth,
handle = this.currHandle,
handleW = (handle) ? handle.offsetWidth : 0;
// Adjusted X and Width, so handle doesn't go outside the bar
barAX = barX + (handleW / 2),
barAW = barW - handleW,
// Percent that the click is through the adjusted area
percent = Math.max(0, Math.min(1, (event.pageX - barAX) / barAW)),
// Percent translated to pixels
percentPix = percent * barAW,
// Percent translated to seconds
newTime = percent * this.duration();
this.volume(percent);
},
updateVolumeBars: function(){
var vol = this.volume();
this.each(this.bels.volumeBars, function(bar){
var barData = _V_.getData(bar),
barX = _V_.findPosX(bar),
barW = bar.offsetWidth,
handle = barData.volumeHandle,
progBar = barData.volumeLevel,
handleW = (handle) ? handle.offsetWidth : 0;
// Adjusted X and Width, so handle doesn't go outside the bar
barAX = barX + (handleW / 2),
barAW = barW - handleW;
// Percent that the click is through the adjusted area
// percent = Math.max(0, Math.min(1, (event.pageX - barAX) / barAW)),
// Percent translated to pixels
// percentPix = percent * barAW,
// Percent translated to seconds
// newTime = percent * this.duration();
progBarProgress = _V_.round(vol * barAW + handleW / 2) + "px";
if (progBar && progBar.style) { progBar.style.width = progBarProgress; }
handle.style.left = _V_.round(vol * barAW)+"px";
});
// Update bar length
// this.each(this.bels.playProgressBars, function(bar){
// if (bar.style) { bar.style.width = _V_.round(progress * 100, 2) + "%"; }
// });
// Move Handle
}// ,
// onVolumeBarFocus: function(event){
// _V_.addEvent(document, "keyup", _V_.proxy(this, this.onVolumeBarKey));
// },
// onVolumeBarKey: function(event){
// if (event.which == 37) {
// event.preventDefault();
// this.currentTime(this.currentTime() - 1);
// } else if (event.which == 39) {
// event.preventDefault();
// this.currentTime(this.currentTime() + 1);
// }
// },
// onVolumeBarBlur: function(event){
// _V_.removeEvent(document, "keyup", _V_.proxy(this, this.onVolumeBarKey));
// }
}
);
/* Mute Toggle
================================================================================ */
VideoJS.fn.newBehavior("muteToggle", function(element){
if (!this.bels.muteToggles) {
this.bels.muteToggles = [];
this.addEvent("volumechange", this.muteTogglesOnVolumeChange);
}
this.bels.muteToggles.push(element);
_V_.addEvent(element, "click", _V_.proxy(this, this.onMuteToggleClick));
// _V_.addEvent(element, "focus", _V_.proxy(this, this.onMuteToggleFocus));
// _V_.addEvent(element, "blur", _V_.proxy(this, this.onMuteToggleBlur));
},
function(){},
{
onMuteToggleClick: function(event){
this.muted( this.muted() ? false : true );
},
muteTogglesOnVolumeChange: function(event){
var vol = this.volume(),
level = 3;
if (vol == 0 || this.muted()) {
level = 0;
} else if (vol < 0.33) {
level = 1;
} else if (vol < 0.67) {
level = 2;
}
this.each(this.bels.muteToggles, function(toggle){
/* TODO improve muted icon classes */
_V_.each([0,1,2,3], function(i){
_V_.removeClass(toggle, "vjs-vol-"+i);
});
_V_.addClass(toggle, "vjs-vol-"+level);
});
}//,
// onMuteToggleFocus: function(event){
// _V_.addEvent(document, "keyup", _V_.proxy(this, this.onMuteToggleKey));
// },
// onMuteToggleKey: function(event){
// if (event.which == 32 || event.which == 13) {
// event.preventDefault();
// this.onMuteToggleClick();
// }
// },
// onMuteToggleBlur: function(event){
// _V_.removeEvent(document, "keyup", _V_.proxy(this, this.onMuteToggleKey));
// }
}
);
+153
Ver Arquivo
@@ -0,0 +1,153 @@
_V_.controlSets.bar = {
options: {},
add: function(){
/* See controls/controls.html to see the HTML this creates. */
// Create a reference to the controls elements
var bar = this.cels.bar = {};
// Control Bar Main Div ("main")
bar.main = _V_.createElement("div", { className: "vjs-controls" });
// Add the controls to the video's container
this.box.appendChild(bar.main);
this.addBehavior(bar.main, "controlBar");
// Play Control
bar.playControl = _V_.createElement("div", {
className: "vjs-play-control vjs-control",
innerHTML: '<div><span class="vjs-control-text">Play</span></div>',
role: "button", tabIndex: 0
});
bar.main.appendChild(bar.playControl);
this.addBehavior(bar.playControl, "playToggle");
/* Time -------------------------------------------------------------- */
// Time Display
bar.currentTime = _V_.createElement("div", {
className: "vjs-current-time vjs-time-controls vjs-control"
});
bar.currentTimeDisplay = _V_.createElement("span", {
className: "vjs-current-time-display",
innerHTML: '0:00'
});
// Put display inside div, inside control div, to follow control scheme.
bar.currentTime.appendChild(_V_.createElement("div").appendChild(bar.currentTimeDisplay));
bar.main.appendChild(bar.currentTime);
this.addBehavior(bar.currentTimeDisplay, "currentTimeDisplay");
// Time Separator (Not used in main skin, but still available, and could be used as a 'spare element')
bar.timeDivider = _V_.createElement("div", {
className: "vjs-time-divider",
innerHTML: '<div><span>/</span></div>'
});
bar.main.appendChild(bar.timeDivider);
// Duration Display
bar.duration = _V_.createElement("div", {
className: "vjs-duration vjs-time-controls vjs-control"
});
bar.durationDisplay = _V_.createElement("span", {
className: "vjs-duration-display",
innerHTML: '0:00'
});
// Put display inside div, inside control div, to follow control scheme.
bar.duration.appendChild(_V_.createElement("div").appendChild(bar.durationDisplay));
bar.main.appendChild(bar.duration);
this.addBehavior(bar.durationDisplay, "durationDisplay");
// Duration Display
bar.remainingTime = _V_.createElement("div", {
className: "vjs-remaining-time vjs-time-controls vjs-control"
});
bar.remainingTimeDisplay = _V_.createElement("span", {
className: "vjs-remaining-time-display",
innerHTML: '-0:00'
});
// Put display inside div, inside control div, to follow control scheme.
bar.remainingTime.appendChild(_V_.createElement("div").appendChild(bar.remainingTimeDisplay));
bar.main.appendChild(bar.remainingTime);
this.addBehavior(bar.remainingTime, "remainingTimeDisplay");
/* Progress -------------------------------------------------------------- */
// Progress Control: Seek, Load Progress, and Play Progress
bar.progressControl = _V_.createElement("div", { className: "vjs-progress-control vjs-control" });
bar.main.appendChild(bar.progressControl);
// Seek Bar and holder for the progress bars
bar.seekBar = _V_.createElement("div", { className: "vjs-progress-holder" });
bar.progressControl.appendChild(bar.seekBar);
// Load Progress Bar
bar.loadProgressBar = _V_.createElement("div", {
className: "vjs-load-progress",
innerHTML: '<span class="vjs-control-text">Loaded: 0%</span>'
});
bar.seekBar.appendChild(bar.loadProgressBar);
this.addBehavior(bar.loadProgressBar, "loadProgressBar");
// Play Progress Bar
bar.playProgressBar = _V_.createElement("div", {
className: "vjs-play-progress",
innerHTML: '<span class="vjs-control-text">Progress: 0%</span>'
});
bar.seekBar.appendChild(bar.playProgressBar);
// Seek Handle
bar.seekHandle = _V_.createElement("div", {
className: "vjs-seek-handle",
innerHTML: '<span class="vjs-control-text">00:00</span>',
tabIndex: 0,
role: "slider", "aria-valuenow": 0, "aria-valuemin": 0, "aria-valuemax": 100
});
bar.seekBar.appendChild(bar.seekHandle);
// SeekBar Behavior includes play progress bar, and seek handle
// Needed so it can determine seek position based on handle position/size
this.addBehavior(bar.seekBar, "seekBar");
/* Fullscreen -------------------------------------------------------------- */
// Fullscreen Button
bar.fullscreenControl = _V_.createElement("div", {
className: "vjs-fullscreen-control vjs-control",
innerHTML: '<div><span class="vjs-control-text">Fullscreen</span></div>',
role: "button", tabIndex: 0
});
bar.main.appendChild(bar.fullscreenControl);
this.addBehavior(bar.fullscreenControl, "fullscreenToggle");
/* Volume -------------------------------------------------------------- */
// Fullscreen Button
bar.volumeControl = _V_.createElement("div", { className: "vjs-volume-control vjs-control" });
bar.volumeBar = _V_.createElement("div", { className: "vjs-volume-bar" });
bar.volumeLevel = _V_.createElement("div", {
className: "vjs-volume-level",
innerHTML: '<span class="vjs-control-text"></span>'
});
bar.volumeHandle = _V_.createElement("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
});
bar.volumeBar.appendChild(bar.volumeLevel);
bar.volumeBar.appendChild(bar.volumeHandle);
bar.volumeControl.appendChild(bar.volumeBar);
bar.main.appendChild(bar.volumeControl);
this.addBehavior(bar.volumeBar, "volumeBar");
// Mute Button
bar.muteControl = _V_.createElement("div", {
className: "vjs-mute-control vjs-control",
innerHTML: '<div><span class="vjs-control-text">Mute</span></div>',
role: "button", tabIndex: 0
});
bar.main.appendChild(bar.muteControl);
this.addBehavior(bar.muteControl, "muteToggle");
},
remove: function(){
this.box.removeChild(this.cels.bigPlayButton);
delete this.cels.bigPlayButton;
this.removeBehavior(this.cels.bigPlayButton, "bigPlayButton");
}
};
+52
Ver Arquivo
@@ -0,0 +1,52 @@
_V_.controlSets.bigPlayButton = {
options: {},
add: function(){
/* Creating this HTML
<div class="vjs-big-play-button"><span></span></div>
*/
this.cels.bigPlayButton = _V_.createElement("div", {
className: "vjs-big-play-button",
innerHTML: "<span></span>"
});
this.box.appendChild(this.cels.bigPlayButton);
this.addBehavior(this.cels.bigPlayButton, "bigPlayButton");
},
remove: function(){
this.removeBehavior(this.cels.bigPlayButton, "bigPlayButton");
this.box.removeChild(this.cels.bigPlayButton);
delete this.cels.bigPlayButton;
}
};
/* Big Play Button Behaviors
================================================================================ */
VideoJS.fn.newBehavior("bigPlayButton",
// Add Big Play Button Behavior
function(element){
if (!this.bels.bigPlayButtons) {
this.bels.bigPlayButtons = [];
this.addEvent("play", this.hideBigPlayButtons);
this.addEvent("ended", this.showBigPlayButtons);
}
this.bels.bigPlayButtons.push(element);
this.addBehavior(element, "playButton");
},
// Remove Big Play Button Behavior
function(element){
},
// Needed functions (added directly to player (this))
{
showBigPlayButtons: function(){
if (!this.options.controlsEnabled) { return; }
this.each(this.bels.bigPlayButtons, function(element){
element.style.display = "block";
});
},
hideBigPlayButtons: function(){
this.each(this.bels.bigPlayButtons, function(element){
element.style.display = "none";
});
}
}
);
+157
Ver Arquivo
@@ -0,0 +1,157 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Controls HTML</title>
<link rel="stylesheet" href="../video-js.css" type="text/css">
</head>
<body>
<div class="video-js vjs-default-skin" style="width: 640px; height: 270px;">
<video id="vid1" class="" preload="none" width="640" height="264" data-setup="" poster="http://video-js.zencoder.com/oceans-clip.png">
<source src="http://pseudo01.hddn.com/vod/demo.flowplayervod/flowplayer-700.flv" type='video/flv'>
<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; codecs="vp8, vorbis"'>
<source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg; codecs="theora, vorbis"'>
</video>
<div class="vjs-controls">
<!-- Play/Pause Button -->
<div class="vjs-play-control vjs-control" role="button" tabindex="0">
<div>
<span class="vjs-control-text">Play</span>
</div>
</div>
<!-- Current Time Display -->
<div class="vjs-current-time vjs-time-controls vjs-control">
<div>
<span class="vjs-current-time-display">00:00</span>
</div>
</div>
<!-- Optional Divider for Time -->
<div class="vjs-time-divider">
<div>
<span>/</span>
</div>
</div>
<!-- Duration Display -->
<div class="vjs-duration vjs-time-controls vjs-control">
<div>
<span class="vjs-duration-display">00:00</span>
</div>
</div>
<!-- Remaining Time Display -->
<div class="vjs-remaining-time vjs-time-controls vjs-control">
<div>
<span class="vjs-remaining-time-display">00:00</span>
</div>
</div>
<!-- Seek Slider and Load & Play Progress Bars -->
<div class="vjs-progress-control vjs-control" role="slider" tabindex="0" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">
<!-- Seek Slider + Holds both progress bars. -->
<div class="vjs-progress-holder">
<!-- Load Progress -->
<div class="vjs-load-progress" title="Load Progress">
<span class="vjs-control-text">Loaded: 0%</span><!-- Support Multiple Load Progress Bars -->
</div>
<!-- Play Progress -->
<div class="vjs-play-progress" title="Play Progress">
<span class="vjs-control-text">Progress: 0%</span>
</div>
</div>
<!-- Seek Handle -->
<div class="vjs-seek-handle" title="Current Time">
<div>
<span class="vjs-control-text">00:00</span>
</div>
</div>
</div>
<!-- Fullscreen Control -->
<div class="vjs-fullscreen-control vjs-control" role="button" tabindex="0">
<div>
<span class="vjs-control-text">Fullscreen</span>
</div>
</div>
<!-- Volume Control -->
<div class="vjs-volume-control vjs-control">
<div class="vjs-volume-bar">
<!-- Volume Bar -->
<div class="vjs-volume-level">
<span class="vjs-control-text"></span>
</div>
<!-- Volume Handle -->
<div class="vjs-volume-handle" tabindex="0" role="slider" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">
<span class="vjs-control-text"></span>
</div>
</div>
</div>
<!-- Mute Button -->
<div class="vjs-mute-control" role="button" tabindex="0">
<div>
<span class="vjs-control-text">Mute</span>
</div>
</div>
<!-- Rewind Button -->
<!-- <div class="vjs-rewind-control vjs-control" title="Rewind" role="button" tabindex="0">
<div>
<span class="vjs-control-text">Rewind</span>
</div>
</div> -->
<!-- Fast Forward Button -->
<!-- <div class="vjs-forward-control" title="Fast Forward" role="button" tabindex="0">
<div>
<span>Fast Forward</span>
</div>
</div> -->
<!-- Previous Video Button -->
<!-- <div class="vjs-previous-control" title="Previous Video" role="button" tabindex="0">
<div>
<span>Previous Video</span>
</div>
</div> -->
<!-- Next Video Button -->
<!-- <div class="vjs-next-control" title="Next Video" role="button" tabindex="0">
<div>
<span>Next Video</span>
</div>
</div> -->
<!-- Subtitles Button -->
<!-- <div class="vjs-subtitles-control" title="Subtitles On/Off" role="button" tabindex="0">
<div>
<span>Closed Captions</span>
</div>
</div> -->
<!-- Captions Button -->
<!-- <div class="vjs-captions-control" title="Captions On/Off" role="button" tabindex="0">
<div>
<span>Closed Captions</span>
</div>
</div> -->
</div>
</div>
</body>
</html>
+133
Ver Arquivo
@@ -0,0 +1,133 @@
_V_.controlSets.main = {
options: {},
add: 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>
*/
this.cels.main = {};
// Create a div to hold the different controls
this.cels.main.bar = _V_.createElement("div", { className: "vjs-controls" });
// Add the controls to the video's container
this.box.appendChild(this.cels.main.bar);
this.addBehavior(this.cels.main.bar, "controlBar");
// Build the play control
this.cels.main.playControl = _V_.createElement("div", { className: "vjs-play-control vjs-control", innerHTML: "<span></span>" });
this.cels.main.bar.appendChild(this.cels.main.playControl);
this.addBehavior(this.cels.main.playControl, "playToggle");
// Build the progress control
this.cels.main.progressControl = _V_.createElement("div", { className: "vjs-progress-control vjs-control" });
this.cels.main.bar.appendChild(this.cels.main.progressControl);
// Create a holder for the progress bars
this.cels.main.progressHolder = _V_.createElement("div", { className: "vjs-progress-holder" });
this.cels.main.progressControl.appendChild(this.cels.main.progressHolder);
this.addBehavior(this.cels.main.progressHolder, "seekBar");
// Create the loading progress display
this.cels.main.loadProgressBar = _V_.createElement("div", { className: "vjs-load-progress" });
this.cels.main.progressHolder.appendChild(this.cels.main.loadProgressBar);
this.addBehavior(this.cels.main.loadProgressBar, "loadProgressBar");
// Create the playing progress display
this.cels.main.playProgressBar = _V_.createElement("div", { className: "vjs-play-progress" });
this.cels.main.progressHolder.appendChild(this.cels.main.playProgressBar);
this.addBehavior(this.cels.main.playProgressBar, "playProgressBar");
// Create the progress time display (00:00 / 00:00)
this.cels.main.timeControl = _V_.createElement("div", { className: "vjs-time-control vjs-control" });
this.cels.main.bar.appendChild(this.cels.main.timeControl);
// // Create the current play time display
this.cels.main.currentTimeDisplay = _V_.createElement("span", { className: "vjs-current-time-display", innerHTML: "00:00" });
this.cels.main.timeControl.appendChild(this.cels.main.currentTimeDisplay);
this.addBehavior(this.cels.main.currentTimeDisplay, "currentTimeDisplay");
// Add time separator
this.cels.main.timeSeparator = _V_.createElement("span", { innerHTML: " / " });
this.cels.main.timeControl.appendChild(this.cels.main.timeSeparator);
// Create the total duration display
this.cels.main.durationDisplay = _V_.createElement("span", { className: "vjs-duration-display", innerHTML: "00:00" });
this.cels.main.timeControl.appendChild(this.cels.main.durationDisplay);
this.addBehavior(this.cels.main.durationDisplay, "durationDisplay");
// Create the volumne control
this.cels.main.volumeControl = _V_.createElement("div", {
className: "vjs-volume-control vjs-control",
innerHTML: '<div><span class="vjs-vc-1"></span><span class="vjs-vc-2"></span><span class="vjs-vc-3"></span><span class="vjs-vc-4"></span><span class="vjs-vc-5"></span><span class="vjs-vc-6"></span></div>'
});
this.cels.main.bar.appendChild(this.cels.main.volumeControl);
this.addBehavior(this.cels.main.volumeControl, "volumeScrubber");
this.cels.main.volumeDisplay = this.cels.main.volumeControl.children[0];
this.addBehavior(this.cels.main.volumeDisplay, "volumeDisplay");
// Crete the fullscreen control
this.cels.main.fullscreenControl = _V_.createElement("div", {
className: "vjs-fullscreen-control vjs-control",
innerHTML: '<div><span class="vjs-fc-1"></span><span class="vjs-fc-2"></span><span class="vjs-fc-3"></span><span class="vjs-fc-4"></span></div>'
});
this.cels.main.bar.appendChild(this.cels.main.fullscreenControl);
this.addBehavior(this.cels.main.fullscreenControl, "fullscreenToggle");
},
remove: function(){
this.box.removeChild(this.cels.bigPlayButton);
delete this.cels.bigPlayButton;
this.removeBehavior(this.cels.bigPlayButton, "bigPlayButton");
}
}
/* Control Bar Behaviors
================================================================================ */
VideoJS.fn.newBehavior("controlBar",
function(element){
if (!this.bels.controlBars) {
this.bels.controlBars = [];
// this.addEvent("mouseover", this.showControlBars);
// this.addEvent("mouseout", this.hideControlBars);
}
this.bels.controlBars.push(element);
},
function(element){},
{
showControlBars: function(){
this.each(this.bels.controlBars, function(bar){
// bar.style.opacity = 1;
bar.style.display = "block";
});
},
hideControlBars: function(){
this.each(this.bels.controlBars, function(bar){
// bar.style.opacity = 0;
bar.style.display = "none";
});
}
}
);
+22
Ver Arquivo
@@ -0,0 +1,22 @@
_V_.controlSets.subtitlesBox = {
options: {},
add: function(){
/* Creating this HTML
<div class="vjs-subtitles"></div>
*/
// Create a reference to the element
var subs = this.cels.subtitlesBox = _V_.createElement("div", { className: "vjs-subtitles" });
// Add the controls to the video's container
this.box.appendChild(subs);
this.addBehavior(subs, "subtitlesDisplay");
},
remove: function(){
this.removeBehavior(this.cels.subtitlesBox, "subtitlesDisplay");
this.box.removeChild(this.cels.subtitlesBox);
delete this.cels.subtitlesBox;
}
};
+381
Ver Arquivo
@@ -0,0 +1,381 @@
// HTML5 Shiv. Must be in <head>.
document.createElement("video");document.createElement("audio");
var VideoJS = _V_ = function(id, options){
// Allow for element or ID to be passed in.
var tag = (typeof id == "string" ? _V_.el(id) : id);
if (!tag || !tag.nodeName) { // Could be a box div also
throw new TypeError("The element or ID supplied is not valid. (video.js)");
return;
}
// Check if (not) using "new" operator before the function to create new instance
if (!(this instanceof arguments.callee)) {
// Return the player attr on the element if it exists
// Otherwise set up a new player.
return tag.player || new VideoJS(id, options);
}
this.tag = tag;
var box = this.box = _V_.createElement("div"),
width = tag.width || 300,
height = tag.height || 150;
// Make player findable on elements
tag.player = box.player = this;
// Wrap video tag in div (box) container
tag.parentNode.insertBefore(box, tag);
box.appendChild(tag); // Breaks iPhone, fixed in HTML5 setup.
// Give video tag properties to box
box.id = tag.id; // ID will now reference box, not the video tag
box.className = tag.className;
box.setAttribute("width", width);
box.setAttribute("height", height);
box.style.width = width+"px";
box.style.height = height+"px";
// Strip tag of basic properties
tag.id += "_html5_api";
tag.className = "vjs-tech";
tag.removeAttribute("width");
tag.removeAttribute("height");
tag.removeAttribute("controls");
// Default Options
this.options = _V_.options; // Global Defaults
_V_.merge(this.options, this.getVideoTagSettings()); // Override with Video Tag Options
_V_.merge(this.options, options); // Override/extend with options from setup call
// 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]);
}
}
}
// Store references to elements for different purposes
this.els = {};
// Tech (playback) Elements. Store playback tech objects for switching between them.
// ex. this.tels.html5 = videoTagElement; this.tels.flowplayer = swfObject;
this.tels = {};
// Behavior Elements. Store refs to elements that trigger/are triggered by a behavior.
// ex. this.bels.playButtons = [element1, element2]
this.bels = {};
// Control Elements. Store refs to elements that are part of control sets
// this.cels.mainControls.playButton = playButtonDiv;
this.cels = {};
// Cache for video property values.
this.values = {};
this.apiIsReady = false;
this.addBehavior(this.box, "box");
this.addEvent("ended", this.handleEnded);
// Build controls when the API is ready
this.addEvent("techready", _V_.proxy(this, function(){
this.each(this.options.controlSets, function(set){
_V_.controlSets[set].add.call(this);
});
}));
// Loop through playback technologies (HTML5, Flash) and check for support
// Then load the best source.
this.src(this.options.sources);
};
VideoJS.options = {
techOrder: ["h5swf","html5","flowplayer"],
controlSets: ["bigPlayButton", "bar", "subtitlesBox"/*, "replay"*/],
controlSetOptions: {
bigPlayButton: {},
bar: {},
replay: {}
},
width: "auto", // Default of web browser is 300x150. Should rely on source width/height.
height: "auto"
};
VideoJS.fn = VideoJS.prototype = {
getVideoTagSettings: function(){
var options = {
sources: [],
tracks: []
};
options.width = this.tag.width;
options.height = this.tag.height;
options.src = this.tag.src;
options.poster = this.tag.poster;
options.preload = this.tag.preload;
options.autoplay = this.tag.getAttribute("autoplay") !== null; // hasAttribute not IE <8 compatible
options.controls = this.tag.getAttribute("controls") !== null;
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)
================================================================================ */
loadTech: function(techName, source){
var tech = this.currentTech = _V_.tech[techName];
// Pause and remove current playback technology
if (this.currentTechName) {
this.removeTech(techName);
// 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 (!this.currentTechName && techName != "html5") {
this.removeTechElement(this.tag);
}
this.currentTechName = techName;
// Turn off API access because we're loading a new tech that might load asynchronously
this.isReady = false;
// Point all internal API calls to new playback tech's API.
this.api = tech.api;
// Finsh API Setup when tech is ready
this.addEvent("techready", _V_.proxy(this, function(){
// Reomve this so it's not called twice next load
this.removeEvent("techready", arguments.callee);
this.currentTechElement = this.tels[this.currentTechName];
// Set up playback technology's event triggers
this.api.setupTriggers.call(this);
this.triggerReady();
// Make playback element clickable
this.addBehavior(this.currentTechElement, "tech");
// Manually track progress in cases where the browser/flash player doesn't report it.
if (!_V_.techSupports(tech, "event", "progress")) { this.manualProgressOn(); }
// Manually track timeudpates in cases where the browser/flash player doesn't report it.
if (!_V_.techSupports(tech, "event", "timeupdate")) { this.manualTimeUpdatesOn(); }
}));
// Initialize new tech if it hasn't been yet
if (this.tels[techName] === undefined) {
tech.init.call(this, source);
} else {
_V_.insertFirst(this.tels[techName], this.box);
this.src(source);
}
},
removeTech: function(techName){
this.removeTechElement(this.tels[techName]);
// Should probably remove API listeners as well
},
removeTechElement: function(el){
this.box.removeChild(el);
},
/* Ready - Trigger functions when player is ready
================================================================================ */
readyQueue: [],
ready: function(fn){
if (this.isReady) {
fn.call(this);
} else {
this.readyQueue.push(fn);
}
},
triggerReady: function(){
if (this.isReady) return;
this.isReady = true;
if (this.readyQueue.length > 0) {
// Call all functions in ready queue
this.each(this.readyQueue, function(fn){
fn.call(this);
});
// Reset Ready Queue
this.readyQueue = [];
}
},
/* Behaviors - Make elements act like specific controls or displays
================================================================================ */
/* TODO - Make behavior classes. Use JR's simple inheritance for sub-classing. */
behaviors: {},
// New Behavior. Gets called in prototype scope (_V_.fn.newBehavior), so added to all instances.
newBehavior: function(name, add, remove, functions){
this.behaviors[name] = { add: add, remove: remove };
this.extend(functions);
},
addBehavior: function(element, behavior){
// Allow passing and ID string
if (typeof element == "string") { element = _V_.el(element); }
this.behaviors[behavior].add.call(this, element);
},
removeBehavior: function(element, behavior){
if (typeof element == "string") { element = _V_.el(element); }
this.behaviors[behavior].remove.call(this, element);
},
/* 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.addEvent("loadstart", _V_.proxy(this, this.trackProgress));
this.trackProgress();
// Set variables of closure
var tech = _V_.tech[this.currentTechName],
el = this.tels[this.currentTechName];
// Watch for native progress event
_V_.addEvent(el, "progress", _V_.proxy(this, function(){
// Remove this listener from the element
_V_.removeEvent(el, "progress", arguments.callee);
// Update known progress support for this playback technology
_V_.updateTechSupport(tech, "event", "progress", true);
// Turn off manual progress tracking
this.manualProgressOff();
}));
},
manualProgressOff: function(){
this.manualProgress = false;
this.removeEvent("loadstart", _V_.proxy(this, this.trackProgress));
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
// Set variables of closure
var tech = _V_.tech[this.currentTechName],
el = this.tels[this.currentTechName];
// Watch for native timeupdate event
_V_.addEvent(el, "timeupdate", _V_.proxy(this, function(){
// Remove this listener from the element
_V_.removeEvent(el, "timeupdate", arguments.callee);
// Update known progress support for this playback technology
_V_.updateTechSupport(tech, "event", "timeupdate", true);
// Turn off manual progress tracking
this.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)
================================================================================ */
handleEnded: function(){
if (this.options.loop) {
this.currentTime(0);
this.play();
} else {
this.currentTime(0);
this.pause();
}
},
/* 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]; }
}
},
/* 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
// this.warning(VideoJS.warnings.localStorageFull);
}
}
}
};
VideoJS.players = {};
+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;
// };
// }
+287
Ver Arquivo
@@ -0,0 +1,287 @@
// Event System (J.Resig - Secrets of a JS Ninja http://jsninja.com/ [Go buy 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) {
for (var i = 0, l = handlers.length; i < l; i++) {
if (handlers[i]) handlers[i].call(elem, event); // Incase one's been removed
}
}
};
}
// 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');
};
}
}());
+268
Ver Arquivo
@@ -0,0 +1,268 @@
_V_.merge = function(obj1, obj2, safe){
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
techSupports: function(tech, type, name){
if (tech.supports[type]) {
return tech.supports[type][name];
}
return false;
},
updateTechSupport: function(tech, type, name, value){
if (!tech.supports[type]) { tech.supports[type] = {}; }
tech.supports[type][name] = value;
},
html5Events: "loadstart,suspend,abort,error,emptied,stalled,loadedmetadata,loadeddata,canplay,canplaythrough,playing,waiting,seeking,seeked,ended,durationchange,timeupdate,progress,play,pause,ratechange,volumechange".split(","),
// 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
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(parent.firstChild, node);
} 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;
},
// 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));
},
// 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);
},
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(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 {
onError();
}
}
});
try {
request.send();
} catch(e) {
_V_.log(e);
onError(e);
}
}
});
// /* Function Context Allows for binding context to functions when using in event listeners
// ================================================================================ */
// Function.prototype.context = function(obj){
// var method = this,
// temp = function(){
// return method.apply(obj, arguments);
// };
// return temp;
// };
+15
Ver Arquivo
@@ -0,0 +1,15 @@
// 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={};}})());
Diff do arquivo suprimido porque uma ou mais linhas são muito longas
+152
Ver Arquivo
@@ -0,0 +1,152 @@
VideoJS.tech.h5swf = {
// swf: "flash/VideoJS.swf",
swf: "https://s3.amazonaws.com/video-js/3.0b/video-js.swf",
// swf: "http://video-js.zencoder.com/3.0b/video-js.swf",
supported: function(){
/* TODO Check for flash, etc. */
return true;
},
canPlaySource: function(sourceObj){
if (sourceObj.type in _V_.tech.h5swf.supports.format) { return "maybe"; }
},
supports: {
format: {
"video/flv": "FLV",
"video/x-flv": "FLV",
"video/mp4": "MP4",
"video/m4v": "MP4"
},
// Optional events that we can manually mimic with timers
event: {
progress: false,
timeupdate: false
}
},
// Init the swf object
init: function(sourceObj){
var player = this,
placeHolder = _V_.createElement("div", { id: player.box.id + "_temp_h5swf" }),
objId = player.box.id+"_h5swf_api"
h5swf = VideoJS.tech.h5swf,
flashvars = {
readyFunction: "_V_.tech.h5swf.onSWFReady",
eventProxyFunction: "_V_.tech.h5swf.onSWFEvent",
errorEventProxyFunction: "_V_.tech.h5swf.onSWFErrorEvent",
src: sourceObj.src,
autoplay: this.options.autoplay,
preload: this.options.preload,
loop: this.options.loop,
muted: this.options.muted
},
params = {
allowScriptAccess: "always",
wmode: "opaque",
bgcolor: "#000000"
},
attributes = {
id: objId,
name: objId,
'class': 'vjs-tech'
};
player.box.appendChild(placeHolder);
swfobject.embedSWF(_V_.tech.h5swf.swf, placeHolder.id, "480", "270", "9.0.124", "", flashvars, params, attributes);
},
onSWFReady: function(currSwf){
// Flash seems to be catching errors, so raising them manally
try {
// Delay for real swf ready.
setTimeout(function(){
var el = _V_.el(currSwf),
player = el.parentNode.player; // Get player from box
el.player = player;
// Update reference to playback technology element
player.tels.h5swf = el;
player.ready(function(){
// this.src("http://video-js.zencoder.com/oceans-clip.mp4");
});
player.triggerEvent("techready");
},0);
} catch(err) {
_V_.log(err);
}
},
onSWFEvent: function(swfID, eventName, other){
try {
var player = _V_.el(swfID).player;
if (player) {
player.triggerEvent(eventName);
}
} catch(err) {
_V_.log(err);
}
},
onSWFErrorEvent: function(swfID, eventName){
_V_.log("Error", eventName);
},
api: {
setupTriggers: function(){
// Using global onSWFEvent func to distribute events
},
play: function(){ this.tels.h5swf.vjs_play(); },
pause: function(){ this.tels.h5swf.vjs_pause(); },
src: function(src){ this.tels.h5swf.vjs_src(src); },
load: function(){ this.tels.h5swf.vjs_load(); },
buffered: function(){
return _V_.createTimeRange(0, this.tels.h5swf.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 = VideoJS.tech.h5swf.api,
readWrite = "src,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.tels.h5swf.vjs_setProperty(attr, val); };
},
createGetter = function(attr){
api[attr] = function(){ return this.tels.h5swf.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);
});
})();
// Special
// canPlayType
// addTextTrack
// textTracks
+157
Ver Arquivo
@@ -0,0 +1,157 @@
// Setup an API for the HTML5 playback technology
VideoJS.tech.html5 = {
supported: function(){
return !!document.createElement("video").canPlayType;
},
canPlaySource: function(srcObj){
return this.tag.canPlayType(srcObj.type); // Switch to global check
// Check Type
// If no Type, check ext
// Check Media Type
},
init: function(sourceObj){
var tag = this.tag, // Reuse original tag for HTML5 playback technology element
html5 = _V_.tech.html5,
options = this.options;
// 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 (html5.supports.movingElementInDOM === false) {
var newTag = _V_.createElement("video", {
id: tag.id,
className: tag.className
});
this.box.removeChild(this.tag);
tag = this.tag = newTag;
this.box.appendChild(tag);
}
// Store reference to playback element
this.tels.html5 = tag;
// Update tag settings, in case they were overridden
_V_.each(["autoplay","preload","loop","muted","poster"], function(attr){
tag[attr] = options[attr];
}, this);
if (tag.currentSrc != sourceObj.src) {
tag.src = sourceObj.src;
} else {
this.triggerEvent("loadstart");
}
this.triggerEvent("techready");
},
supports: {
/* Will hold support info as it's discovered */
},
api: {
setupTriggers: function(){
// Make video events trigger player events
// May seem verbose here, but makes other APIs possible.
// ["play", "playing", "pause", "ended", "volumechange", "error", "progress", "seeking", "timeupdate"]
var types = _V_.html5Events,
i;
for (i = 0;i<types.length; i++) {
_V_.addEvent(this.tels.html5, types[i], _V_.proxy(this, function(e){
e.stopPropagation();
this.triggerEvent(e);
}));
}
},
removeTriggers: function(){},
play: function(){ this.tels.html5.play(); },
pause: function(){ this.tels.html5.pause(); },
paused: function(){ return this.tels.html5.paused; },
currentTime: function(){ return this.tels.html5.currentTime; },
setCurrentTime: function(seconds){
try { this.tels.html5.currentTime = seconds; }
catch(e) {
_V_.log(e);
// this.warning(VideoJS.warnings.videoNotReady);
}
},
duration: function(){ return this.tels.html5.duration || 0; },
buffered: function(){ return this.tels.html5.buffered; },
volume: function(){ return this.tels.html5.volume; },
setVolume: function(percentAsDecimal){ this.tels.html5.volume = percentAsDecimal; },
muted: function(){ return this.tels.html5.muted; },
setMuted: function(muted){ this.tels.html5.muted = muted },
width: function(){ return this.tels.html5.offsetWidth; },
height: function(){ return this.tels.html5.offsetHeight; },
supportsFullScreen: function(){
if(typeof this.tels.html5.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.tels.html5.webkitEnterFullScreen();
} catch (e) {
if (e.code == 11) { this.warning(VideoJS.warnings.videoNotReady); }
}
},
src: function(src){ this.tels.html5.src = src; },
load: function(){ this.tels.html5.load(); },
currentSrc: function(){ return this.tels.html5.currentSrc; },
preload: function(){ return this.tels.html5.preload; },
setPreload: function(val){ this.tels.html5.preload = val; },
autoplay: function(){ return this.tels.html5.autoplay; },
setAutoplay: function(val){ this.tels.html5.autoplay = val; },
loop: function(){ return this.tels.html5.loop; },
setLoop: function(val){ this.tels.html5.loop = val; },
error: function(){ return this.tels.html5.error; },
networkState: function(){ return this.tels.html5.networkState; },
readyState: function(){ return this.tels.html5.readyState; },
seeking: function(){ return this.tels.html5.seeking; },
initialTime: function(){ return this.tels.html5.initialTime; },
startOffsetTime: function(){ return this.tels.html5.startOffsetTime; },
played: function(){ return this.tels.html5.played; },
seekable: function(){ return this.tels.html5.seekable; },
ended: function(){ return this.tels.html5.ended; },
videoTracks: function(){ return this.tels.html5.videoTracks; },
audioTracks: function(){ return this.tels.html5.audioTracks; },
videoWidth: function(){ return this.tels.html5.videoWidth; },
videoHeight: function(){ return this.tels.html5.videoHeight; },
textTracks: function(){ return this.tels.html5.textTracks; },
defaultPlaybackRate: function(){ return this.tels.html5.defaultPlaybackRate; },
playbackRate: function(){ return this.tels.html5.playbackRate; },
mediaGroup: function(){ return this.tels.html5.mediaGroup; },
controller: function(){ return this.tels.html5.controller; },
controls: function(){ return this.tels.html5.controls; },
defaultMuted: function(){ return this.tels.html5.defaultMuted; }
}
};
/* Device Fixes
================================================================================ */
// iOS
if (_V_.isIOS()) {
// If you move a video element in the DOM, it breaks video playback.
_V_.tech.supports.movingElementInDOM = false;
}
// 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" : "";
};
}
}
+131
Ver Arquivo
@@ -0,0 +1,131 @@
_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"];
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);
}
};
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"
}
+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;
}
+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>
+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>
+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;
});
+56
Ver Arquivo
@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>QUnit Test Suite</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" type="text/javascript" charset="utf-8"></script>
<script src="../src/lib.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/ecma.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/json.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/api.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/events.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/tracks.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/behaviors/behaviors.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/behaviors/seekBar.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/behaviors/volume.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/behaviors/texttrackdisplays.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/controls/bigPlay.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/controls/bar.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/controls/subtitlesBox.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/tech/html5.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/tech/flowplayer.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/autoload.js" type="text/javascript" charset="utf-8"></script>
<script src="../src/log.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="qunit/qunit/qunit.css" type="text/css" media="screen">
<script type="text/javascript" src="qunit/qunit/qunit.js"></script>
<script type="text/javascript" src="test.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>
+154
Ver Arquivo
@@ -0,0 +1,154 @@
var tagCode = '<video id="vid1" class="video-js vjs-default-skin" preload="none" width="640" height="264" data-setup=\'{}\' poster="http://video-js.zencoder.com/oceans-clip.png">';
tagCode+= '<source src="http://video-js.zencoder.com/oceans-clip.mp4" type="video/mp4">';
tagCode+= '<source src="http://video-js.zencoder.com/oceans-clip.webm" type="video/webm">';
tagCode+= '<source src="http://video-js.zencoder.com/oceans-clip.ogv" type="video/ogg; codecs=\'theora, vorbis\'">';
tagCode+= '<track kind="subtitles" src="http://videojs.com/subtitles/demo-subtitles.srt" srclang="en-US" label="English"></track>';
tagCode+= '</video>';
function playerSetup(){
document.body.innerHTML += tagCode;
var vid = document.getElementById("vid1");
this.player = _V_(vid);
stop();
this.player.ready(_V_.proxy(this, function(){
start();
}));
}
function playerTeardown(){
document.body.removeChild(document.getElementById("vid1"));
ok(!document.getElementById("vid1"), "torndown");
}
module("video.js setup", {
setup: playerSetup,
teardown: playerTeardown
});
test("Player Set Up", function() {
ok(this.player);
});
/* Events
================================================================================ */
module("API Events", {
setup: playerSetup,
teardown: playerTeardown
});
// Play Event
test("play", function() {
this.player.addEvent("play", _V_.proxy(this, function(){
start();
ok(true);
}));
this.player.play();
});
// Playing Event
test("playing", function() {
this.player.addEvent("playing", _V_.proxy(this, function(){
start();
ok(true, "playing");
}));
this.player.play();
});
// Pause Event
test("pause", function() {
this.player.addEvent("pause", _V_.proxy(this, function(){
start();
ok(true);
}));
this.player.addEvent("playing", _V_.proxy(this, function(){
this.player.pause();
}));
this.player.play();
});
// Pause Event
test("timeupdate", function() {
this.player.addEvent("timeupdate", _V_.proxy(this, function(){
start();
ok(true);
}));
this.player.addEvent("playing", _V_.proxy(this, function(){
this.player.pause();
}));
this.player.play();
});
/* Methods
================================================================================ */
module("API Methods", {
setup: playerSetup,
teardown: playerTeardown
});
// Play Method
test("play()", function() {
this.player.addEvent("playing", _V_.proxy(this, function(){
start();
ok(true);
}));
this.player.play();
});
// Pause Method
test("pause()", function() {
this.player.addEvent("pause", _V_.proxy(this, function(){
start();
ok(true);
}));
this.player.addEvent("playing", _V_.proxy(this, function(){
this.player.pause();
}));
this.player.play();
});
test("currentTime()", function() {
// Need video loaded before we can call current time
this.player.addEvent("loadstart", _V_.proxy(this, function(){
start();
ok(true, "vid loading");
// Watch for timeudpate
this.player.addEvent("timeupdate", _V_.proxy(this, function(){
start();
equal(this.player.currentTime(), 0, "time is 0");
this.player.removeEvent("timeupdate", arguments.callee);
// Test again for later time
this.player.addEvent("timeupdate", _V_.proxy(this, function(){
start();
notEqual(this.player.currentTime(), 0, "time is not 0");
this.player.removeEvent("timeupdate", arguments.callee);
}));
// Stop and trigger time
stop();
this.player.currentTime(10);
}));
// Stop and trigger time
stop();
this.player.currentTime(0);
}));
stop();
this.player.load();
// Watch for timeudpate
this.player.addEvent("timeupdate", _V_.proxy(this, function(){
start();
notEqual(this.player.currentTime(), 0, "time is not 0");
this.player.removeEvent("timeupdate", arguments.callee);
}));
// Stop and trigger time
stop();
this.player.load();
});
+156
Ver Arquivo
@@ -0,0 +1,156 @@
API
===
The VideoJS API allows you to interact with the video through Javascript, whether the browser is playing the video through HTML5 video or any number of media playback technologies that have an API wrapper (e.g. video-js.flowplayer.js).
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 (example_video_2, example_video_3, etc.).
_V_("example_video_1")
Wait until Ready
----------------
The time it takes VideoJS 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.
_V_("example_video_1").ready(function(){
var myPlayer = this;
});
API Methods
-----------
Now that you have access to a ready player, you can control the video or react to video events using the following functions. The VideoJS API function names follow the HTML5 media API. The main difference is that attributes which you would get or set on a video element directly ( videoElement.currentTime = "120"; ), you would use a function syntax for VideoJS ( myPlayer.currentTime(120); )
### play()
Start video playback.
Returns the player object.
Example:
myPlayer.play();
### pause()
Pause the video playback.
Returns: the player object
Example:
myPlayer.pause();
### 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
### 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();
### buffered()
Returns a [TimeRange](http://videojs.com/docs/timerange.html) with sections of the video that have been downloaded. If you just want the percent of the video that's been downloaded, use bufferedPercent.
Example:
var whatHasBeenBuffered = myPlayer.buffered();
### bufferedPercent()
Returns the percent (as a decimal) of the video that's been downloaded.
Example:
var howMuchIsDownloaded = myPlayer.bufferedPercent();
### 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
### 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);
### 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();
Events
------
You can attach event listeners to the player similarly to how you would for a video element.
var myFunc = function(){
// Do something when the event is fired
};
myPlayer.addEvent("eventName", myFunc);
You can also remove the listeners later.
myPlayer.removeEvent("eventName", myFunc);
### 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>
+50
Ver Arquivo
@@ -0,0 +1,50 @@
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");
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
@@ -0,0 +1,9 @@
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.
+2
Ver Arquivo
@@ -0,0 +1,2 @@
Options
=======
+29
Ver Arquivo
@@ -0,0 +1,29 @@
Setup
=====
Step 1: Include the VideoJS Javascript and CSS files in the head of your page.
------------------------------------------------------------------------------
You can download the VideoJS source and host it on your own servers, or use the free CDN hosted version (thanks to Zencoder).
<script src="http://video-js.zencoder.com/3.0/video.min.js"></script>
<link href="http://video-js.zencoder.com/3.0/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 VideoJS:
1. The 'data-setup' Atrribute tells VideoJS 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 VideoJS 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)).
<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>
+44
Ver Arquivo
@@ -0,0 +1,44 @@
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, VideoJS.swf, etc. (not just "Flash").
With the VideoJS API you can control any type of browser-based video, as long as the playback technology in use has an API and a VideoJS API wrapper for it.
Including an API Wrapper
------------------------
Building an API Wrapper
-----------------------
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
+2
Ver Arquivo
@@ -0,0 +1,2 @@
TimeRange
=========
+8
Ver Arquivo
@@ -0,0 +1,8 @@
HTML5 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)
Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 120 KiB

Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 689 B

Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 83 KiB

Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 1.2 KiB

Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 5.5 KiB

Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 5.9 KiB

Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 5.6 KiB

Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 5.0 KiB

Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 4.0 KiB

Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 3.6 KiB

Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 3.1 KiB

Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 3.2 KiB

Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 5.5 KiB

Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 2.1 KiB

Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 2.2 KiB

Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 2.0 KiB

Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 2.2 KiB

-182
Ver Arquivo
@@ -1,182 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>HTML5 Video Player | Video JS</title>
<meta name="google-site-verification" content="QHf9MEYVlEWoNHbzTeUkSQsbRT5Twzqu6N0nX1i3nes" />
<script src="video-js/video.js" type="text/javascript" charset="utf-8"></script>
<!-- JQuery not required, but used for dom ready function -->
<script src="javascripts/jquery-1.4.2.min.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="stylesheets/base.css" type="text/css" media="all" charset="utf-8" />
<link rel="stylesheet" href="video-js/video-js.css" type="text/css" media="all" charset="utf-8" />
<link rel="stylesheet" href="stylesheets/site.css" type="text/css" media="all" charset="utf-8" />
<!--[if !IE 7]>
<style type="text/css">
#wrap {display:table;height:100%}
</style>
<![endif]-->
<script type="text/javascript" charset="utf-8">
VideoJS.setupAllWhenReady();
// See demo.html for other setup options
</script>
</head>
<body>
<div id="wrap">
<div id="main">
<ul id="nav">
<li><a href="skins.html">Skins</a></li>
<li><a href="http://github.com/zencoder/video-js">Source</a></li>
<li><a href="http://wiki.github.com/zencoder/video-js/browser-device-compatibility">Compatibility</a></li>
<li><a href="http://github.com/zencoder/video-js/issues">Issue Tracker</a></li>
<li><a href="http://wiki.github.com/zencoder/video-js/">Wiki</a></li>
</ul>
<h1>Video JS</h1>
<p class="tagline">Open Source HTML5 Video Player</p>
<!-- Begin VideoJS -->
<div class="video-js-box">
<!-- Using the Video for Everybody Embed Code http://camendesign.com/code/video_for_everybody -->
<video class="video-js" width="640" height="264" poster="//vjs.zencdn.net/v/oceans.png" controls preload>
<source src="//vjs.zencdn.net/v/oceans.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
<source src="//vjs.zencdn.net/v/oceans.webm" type='video/webm; codecs="vp8, vorbis"'>
<source src="//vjs.zencdn.net/v/oceans.ogg" type='video/ogg; codecs="theora, vorbis"'>
<object 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="allowfullscreen" value="true" />
<param name="flashvars" value='config={"clip":{"url":"//vjs.zencdn.net/v/oceans.mp4","autoPlay":false,"autoBuffering":true}}' />
<img src="//vjs.zencdn.net/v/oceans.png" width="640" height="264" alt="Poster Image"
title="No video playback capabilities." />
</object>
</video>
<p class="vjs-no-video"><strong>Download Video:</strong>
<a href="//vjs.zencdn.net/v/oceans.mp4">MP4</a>,
<a href="//vjs.zencdn.net/v/oceans.webm">WebM</a>,
<a href="//vjs.zencdn.net/v/oceans.ogg">Ogg</a><br>
<a href="http://videojs.com">HTML5 Video Player</a> by <a href="http://videojs.com">VideoJS</a>
</p>
</div>
<!-- End VideoJS -->
<p id="video_note">Video clip is from <a href="http://disney.go.com/disneynature/oceans/" title="Oceans">Disney&rsquo;s Oceans</a></p>
<p>Video JS is a javascript-based video player that uses the HTML5 video functionality built into advanced browsers. In general, the benefit of using an HTML5 player is a consistent look between browsers.</p>
<p id="sponsor">
<a href="http://zencoder.com">Video encoding &amp; hosting</a> provided by:<br>
<a href="http://zencoder.com"><img src="images/zencoder-logo.png" border="0" alt="Zencoder - Video Encoding"></a>
</p>
<div id="features_and_support" class="clearfix">
<div id="features">
<h6>Features</h6>
<ul id="feature_list">
<li>Free &amp; Open Source</li>
<li>Lightweight. <strong>NO IMAGES USED</strong></li>
<li>100% skinnable using CSS</li>
<li>Library independent</li>
<li>Easy to use</li>
<li>Easy to understand &amp; extend</li>
<li>Consistent look between browsers</li>
<li>Full Window Mode</li>
<li>Volume Control</li>
<li>Forced fallback to Flash (even when there is an unsupported source)</li>
<li></li>
</ul>
</div>
<div id="supported" class="clearfix">
<h6>Download</h6>
<div class="supported-section">
<a href="http://github.com/zencoder/video-js/zipball/master" title="Zip Download"><img src="images/icons/zip.png" alt="Zip Download"></a>
<a href="http://github.com/zencoder/video-js/tarball/master" title="Tar Download"><img src="images/icons/tar.png" alt="Tar Download"></a>
</div>
<h6>Supported Browsers</h6>
<div class="supported-section">
<a href="http://www.mozilla.com/en-US/firefox/firefox.html" title="Firefox"><img src="images/icons/firefox.png" alt="Firefox"></a>
<a href="http://www.apple.com/safari/" title="Safari"><img src="images/icons/safari.png" alt="Safari"></a>
<a href="http://www.google.com/chrome" title="Chrome"><img src="images/icons/chrome.png" alt="Chrome"></a>
<a href="http://www.opera.com/" title="Opera"><img src="images/icons/opera.png" alt="Opera"></a>
</div>
<h6>Fallback Support For</h6>
<div class="supported-section">
<a href="http://www.microsoft.com/windows/Internet-explorer/default.aspx" title="IE"><img src="images/icons/ie.png" alt="IE"></a>
</div>
<h6>Supported Formats</h6>
<div class="supported-section">
<a href="http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC" title="h264"><img src="images/icons/h264.png" alt="h264"></a>
<a href="http://www.theora.org/" title="Ogg"><img src="images/icons/ogg.png" alt="Ogg"></a>
<a href="http://www.webmproject.org/" title="WebM"><img src="images/icons/webm.png" alt="WebM"></a>
</div>
<h6>Compatible With</h6>
<div class="supported-section">
<a href="http://www.apple.com/iphone/" title="iPhone"><img src="images/icons/iphone.png" alt="iPhone"></a>
<a href="http://www.apple.com/ipad/" title="iPad"><img src="images/icons/ipad.png" alt="iPad"></a>
</div>
</div>
<p id="issues_link">Submit any bugs in the <a href="http://github.com/zencoder/video-js/issues">Issue Tracker</a> or update the <a href="http://wiki.github.com/zencoder/video-js/browser-device-compatibility">Compatibility Table</a></p>
<p>Moved <a href="comments.html">comments</a> to another page temporarily.</p>
<!-- <div id="disqus_thread"></div>
<script type="text/javascript">
/**
* var disqus_identifier; [Optional but recommended: Define a unique identifier (e.g. post id or slug) for this thread]
*/
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://videojs.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript=videojs">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a> -->
</div>
</div>
<div id="footer">
&copy; <a href="//videojs.github.io/video.js">The Video JS Project</a>. Sponsored by <a href="http://zencoder.com">Zencoder</a>.
</div>
</div>
<!-- <script type="text/javascript">
//<![CDATA[
(function() {
var links = document.getElementsByTagName('a');
var query = '?';
for(var i = 0; i < links.length; i++) {
if(links[i].href.indexOf('#disqus_thread') >= 0) {
query += 'url' + i + '=' + encodeURIComponent(links[i].href) + '&';
}
}
document.write('<script charset="utf-8" type="text/javascript" src="http://disqus.com/forums/videojs/get_num_replies.js' + query + '"></' + 'script>');
})();
//]]>
</script> -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-16505296-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>

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