3 * Copyright(c) 2006-2011 Sencha Inc.
5 * http://www.sencha.com/license
8 // From code originally written by David Davis (http://www.sencha.com/blog/html5-video-canvas-and-ext-js/)
11 * For HTML5 video to work, your server must
12 * send the right content type, for more info see:
13 * http://developer.mozilla.org/En/HTML/Element/Video
16 Ext.define('Ext.ux.desktop.Video', {
17 extend: 'Ext.panel.Panel',
19 alias: 'widget.video',
25 bodyStyle: 'background-color:#000;color:#fff',
28 initComponent: function () {
32 afterRender: function () {
35 if (this.fallbackHTML) {
36 fallback = this.fallbackHTML;
38 fallback = "Your browser does not support HTML5 Video. ";
41 fallback += 'Upgrade Chrome.';
42 } else if (Ext.isGecko) {
43 fallback += 'Upgrade to Firefox 3.5 or newer.';
45 var chrome = '<a href="http://www.google.com/chrome">Chrome</a>';
46 fallback += 'Please try <a href="http://www.mozilla.com">Firefox</a>';
49 fallback += ', ' + chrome +
50 ' or <a href="http://www.google.com/chromeframe">Chrome Frame for IE</a>.';
52 fallback += ' or ' + chrome + '.';
57 // match the video size to the panel dimensions
58 var size = this.getSize();
60 var cfg = Ext.copyTo({
65 this, 'poster,start,loopstart,loopend,playcount,autobuffer,loop');
67 // just having the params exist enables them
75 // handle multiple sources
76 if (Ext.isArray(this.src)) {
79 for (var i = 0, len = this.src.length; i < len; i++) {
80 if (!Ext.isObject(this.src[i])) {
81 Ext.Error.raise('The src list passed to "video" must be an array of objects');
85 Ext.applyIf({tag: 'source'}, this.src[i])
98 this.video = this.body.createChild(cfg);
99 var el = this.video.dom;
100 this.supported = (el && el.tagName.toLowerCase() == 'video');
103 doComponentLayout : function() {
106 me.callParent(arguments);
109 me.video.setSize(me.body.getSize());
112 onDestroy: function () {
113 var video = this.video;
115 var videoDom = video.dom;
116 if (videoDom && videoDom.pause) {