Skip to content

Extension for Google Chrome to replace video providers embedded Flash players with standard HTML5 video tags.

License

Notifications You must be signed in to change notification settings

drodriguez/video5

Repository files navigation

Video5
======

Extension for Google Chrome to replace video providers embedded Flash players with 
standard HTML5 video tags.


Supported
---------

* Youtube

  Youtube.com pages are not modified. You should try `Youtube HTML5 Beta
  <http://www.youtube.com/html5>`_. Youtube videos embedded on other web pages
  are supported.

* Vimeo

  Vimeo.com pages are not modified. You should try `Vimeo HTML5 Beta
  <http://vimeo.com/blog:268>`_ (click on the "Switch to HTML5 Player" link
  below any video). Vimeo videos embedded on other web pages are supported.


Extending
---------

To add support for a new video player provider,

1. Create a new .js file inside the handlers subdirectory, modeled after
   youtube.js or any other file in that directory.  Specifically, say you are
   supporting "FooVideo" in foo.js::

     // Your file MUST be wrapped in a function, and you MUST return your
     // handler object at the end of your function.
     (function() {
     
     // The constructor is passed the DOM object for the Flash plugin, the url
     // of the player.
     FooVideo = function(domObject, url) {
       this.domObject = domObject;
       this.url = url;
     };

     // Define canHandleURL() to filter the video site URL you support
     FooVideo.canHandleURL = function(url) {
       return url.match(/foo/)
     };

     // This is the “entry point” for your handler, from this point you can
     // do whatever your handler need to do to get the video final URL.
     FooVideo.prototype.start = function() {
       // ...
       // You can send a request to the background page in case you need to
       // fetch external resources using XHR.
       chrome.extension.sendRequest({action: 'ajax',
         args: {
           type: 'GET',
           url: myUrl
       }}, function(response) {
         /* do something with response.data and response.textStatus */
       });
       // ...
       // Invoke VideoHandlers.replaceFlashObjectWithVideo providing the
       // DOM object to substitute and the video URL to use. You can also
       // provide a watchURL and a downloadURL that will create links in the
       // interface for those actions.
       VideoHandlers.replaceFlashObjectWithVideo(this.domObject,
         videoURL,
         { watchURL: watchURL, downloadURL: downloadURL });
     }
     
     // This is the end, so return your handler object
     return FooVideo;
     })

2. Modify video5.js to include your new handler::
   
     VideoHandlers.register('youtube', 'foo');
                                       ^^^^^


Authors
-------

Daniel Rodríguez Troitiño (drodriguez)
  Original implementation including Youtube support

Yaohan Chen (hagabaka)
  Ideas and supporting code about the splitting the handlers code.
  Vimeo support.

About

Extension for Google Chrome to replace video providers embedded Flash players with standard HTML5 video tags.

Resources

License

Stars

Watchers

Forks

Packages

No packages published