/*! * Ext JS Library 4.0 * Copyright(c) 2006-2011 Sencha Inc. * licensing@sencha.com * http://www.sencha.com/license */ // From code originally written by David Davis (http://www.sencha.com/blog/html5-video-canvas-and-ext-js/) /* -NOTICE- * For HTML5 video to work, your server must * send the right content type, for more info see: * http://developer.mozilla.org/En/HTML/Element/Video */ Ext.define('Ext.ux.desktop.Video', { extend: 'Ext.panel.Panel', alias: 'widget.video', layout: 'fit', autoplay: false, controls: true, bodyStyle: 'background-color:#000;color:#fff', html: '', tpl: [ '' ], initComponent: function () { var me = this, fallback, size, cfg, el; if (me.fallbackHTML) { fallback = me.fallbackHTML; } else { fallback = "Your browser does not support HTML5 Video. "; if (Ext.isChrome) { fallback += 'Upgrade Chrome.'; } else if (Ext.isGecko) { fallback += 'Upgrade to Firefox 3.5 or newer.'; } else { var chrome = 'Chrome'; fallback += 'Please try Firefox'; if (Ext.isIE) { fallback += ', ' + chrome + ' or Safari.'; } else { fallback += ' or ' + chrome + '.'; } } } me.fallbackHTML = fallback; cfg = me.data = Ext.copyTo({ tag : 'video', html: fallback }, me, 'id,poster,start,loopstart,loopend,playcount,autobuffer,loop'); // just having the params exist enables them if (me.autoplay) { cfg.autoplay = 1; } if (me.controls) { cfg.controls = 1; } // handle multiple sources if (Ext.isArray(me.src)) { cfg.src = me.src; } else { cfg.src = [ {src: me.src} ]; } me.callParent(); }, afterRender: function() { var me = this; me.callParent(); me.video = me.body.getById(me.id + '-video'); el = me.video.dom; me.supported = (el && el.tagName.toLowerCase() == 'video'); if (me.supported) { me.video.on('error', me.onVideoError, me); } }, getFallback: function() { return '