Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
868 views
in Technique[技术] by (71.8m points)

extjs - Ext JS - how to preview local video file?

Playing video from given url in extjs is quite easy:

Ext.application({
    name : 'Fiddle',

    launch : function() {
        Ext.create('Ext.panel.Panel', {
            renderTo: Ext.getBody(),
            itemId: 'foo',
            html: '<iframe width="300" height="200" src="//content.jwplatform.com/videos/HkauGhRi-640.mp4" frameborder="0" allowfullscreen></iframe>',
        });
    }
});

However, hot to play (preview) local video file with filefield?

question from:https://stackoverflow.com/questions/65865914/ext-js-how-to-preview-local-video-file

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

For modern toolkit: https://docs.sencha.com/extjs/7.3.1/modern/Ext.Video.html

Ext.create({
    xtype: 'panel',
    renderTo: Ext.getBody(),
    width: 800,
    height: 600,
    shadow: true,
    scrollable: true,
    title: 'My Video Panel',
    layout: 'hbox',
    items: [{
        xtype: 'video',
        onVideoplayerid0Play: function (media, eOpts) {
            var video = Ext.get(media.id).select('video:first-of-type ', true).elements[0];
            if (video.style.display == 'none') {
                video.style.display = '';
            }
        },
        url: 'https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4',
        listeners: {
            painted: function (video) {
                video.play();
            },
            play: function(video) {
                // BUG fix. on auto play the black display is not disappeared. 
                document.getElementsByClassName('x-video-ghost')[0].style.display = 'none';
            }
        }
    }]
});

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...