]>
git.proxmox.com Git - extjs.git/blob - extjs/modern/modern/src/Video.js
2 * Provides a simple Container for HTML5 Video.
6 * - There are quite a few issues with the `<video>` tag on Android devices. On Android 2+, the video will
7 * appear and play on first attempt, but any attempt afterwards will not work.
12 * - {@link #autoPause}
13 * - {@link #autoResume}
17 * - {@link #method-pause}
18 * - {@link #method-play}
23 * var panel = Ext.create('Ext.Panel', {
32 * url : "porsche911.mov",
33 * posterUrl: 'porsche.png'
38 Ext
.define('Ext.Video', {
44 * @cfg {String/Array} url
45 * Location of the video to play. This should be in H.264 format and in a .mov file format.
50 * @cfg {String} posterUrl
51 * Location of a poster image to be shown before showing the video.
60 baseCls
: Ext
.baseCSSPrefix
+ 'video',
63 * @cfg {Boolean} controls
64 * Determines if native controls should be shown for this video player.
71 * @property {Ext.dom.Element} ghost
75 classList
: [Ext
.baseCSSPrefix
+ 'video-ghost']
79 classList
: [Ext
.baseCSSPrefix
+ 'media']
82 initialize: function() {
99 if (Ext
.os
.is
.Android4
|| Ext
.os
.is
.iPad
) {
100 this.isInlineVideo
= true;
104 applyUrl: function(url
) {
105 return [].concat(url
);
108 updateUrl: function(newUrl
) {
111 newLn
= newUrl
.length
,
112 existingSources
= media
.query('source'),
113 oldLn
= existingSources
.length
,
117 for (i
= 0; i
< oldLn
; i
++) {
118 Ext
.fly(existingSources
[i
]).destroy();
121 for (i
= 0; i
< newLn
; i
++) {
122 media
.appendChild(Ext
.Element
.create({
128 if (me
.isPlaying()) {
133 updateControls: function(value
) {
134 this.media
.set({controls
:value
? true : undefined});
137 onActivate: function() {
138 this.media
.setTop(0);
141 onDeactivate: function() {
143 this.media
.setTop(-2000);
149 * Called when the {@link #ghost} element is tapped.
151 onGhostTap: function() {
157 // Browsers which support native video tag display only, move the media down so
158 // we can control the Viewport
165 * native video tag display only, move the media down so we can control the Viewport
167 onPause: function() {
168 this.callParent(arguments
);
169 if (!this.isInlineVideo
) {
170 this.media
.setTop(-2000);
177 * native video tag display only, move the media down so we can control the Viewport
180 this.callParent(arguments
);
181 this.media
.setTop(0);
185 * Updates the URL to the poster, even if it is rendered.
186 * @param {Object} newUrl
188 updatePosterUrl: function(newUrl
) {
189 var ghost
= this.ghost
;
191 ghost
.setStyle('background-image', 'url(' + newUrl
+ ')');