Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

MediaElement JS Player Component

Bryson Dunn
7 years ago Jun 16, 2015 2:22pm
Daniel Fiederling
7 years ago Jun 17, 2015 6:02pm

I tried to extend the sample code by adding some playback features to the youtube video (pause, progress, volume) The video starts, but the player doesn't show the functions play/pause, change progress, volume, etc. 

// YouTube player
        MediaElementPlayer videoPlayer2 = new MediaElementPlayer(MediaElementPlayer.Type.VIDEO);
        
        videoPlayer2.setSource(new ExternalResource("https://youtu.be/kh29_SERH0Y"));

        MediaElementPlayerOptions options = videoPlayer2.getOptions();
        Feature features = new Feature {Feature.PLAYPAUSE, Feature.PROGRESS, Feature.VOLUME};
        
        options.setFeatures(features);
        videoPlayer2.setOptions(options);
                        
        addComponent(videoPlayer2);

Do you have any Ideas? 
 

Ted Carroll
7 years ago Jul 19, 2015 8:11am

Daniel

How have you got on ?  I have got this to work by adding my own buttons for play and pause..

class MEVideoViewer extends Window
    {
        MediaElementPlayer videoPlayer = new MediaElementPlayer(MediaElementPlayer.Type.VIDEO);
        public MEVideoViewer(String uri,String sTitle) {
            this.setCaption(sTitle);
            setModal(true);
            setWidth("800px");
                VerticalLayout main = new VerticalLayout();
            VerticalLayout layout = new VerticalLayout();
            Button pause = new Button("Pause");
            pause.addClickListener(new Button.ClickListener() {
                public void buttonClick(ClickEvent event) {
                    videoPlayer.pause();
                    System.out.println("Current time is"+videoPlayer.getCurrentTime());
                }
            });
            Button play = new Button("Play");
            play.addClickListener(new Button.ClickListener() {
                public void buttonClick(ClickEvent event) {
                    videoPlayer.play();
                    System.out.println("Current time is"+videoPlayer.getCurrentTime());
                }
            });
            layout.addComponent(videoPlayer);
            videoPlayer.setSource(new ExternalResource("https://youtu.be/kh29_SERH0Y"));
            videoPlayer.setCaption("this is playing you tube video");
            videoPlayer.setCurrentTime(10000);
            videoPlayer.play();
            main.addComponent(layout);
            main.addComponent(pause);
            main.addComponent(play);
            setContent(main);
            
        }    
 

Ted Carroll
7 years ago Jul 19, 2015 8:17am

Bryson Dunn: Starting this thread for discussion on the mediaelementjs-player addon.

I can get the viewer to work with an ExternalResource but not with a FileResource - I am developing on Windows with Eclipse - and accessing an external file on the Windows machine- do you have any examples of this working? 

Bryson Dunn
7 years ago Jul 27, 2015 8:25pm
Ted Carroll
7 years ago Jul 29, 2015 6:50pm
Bryson Dunn
7 years ago Jul 30, 2015 7:27pm
Ted Carroll
7 years ago Jul 31, 2015 7:59am
Ted Carroll
7 years ago Aug 14, 2015 11:26am

Hi Bryson - any luck on this one ?  Thanks  Ted

Anton Nikonienkov
7 years ago Aug 15, 2015 12:06pm
Tapabrata Pal
7 years ago Aug 29, 2015 2:49pm
Anton Nikonienkov
7 years ago Aug 29, 2015 6:39pm
Tapabrata Pal
7 years ago Aug 29, 2015 6:48pm
Tapabrata Pal
7 years ago Aug 29, 2015 6:54pm
Ted Carroll
7 years ago Aug 30, 2015 6:25pm
Bryson Dunn
7 years ago Aug 31, 2015 3:00am
Radosław Bojba
7 years ago Sep 25, 2015 5:30pm
Anton Nikonienkov
7 years ago Sep 26, 2015 9:42am
Ted Carroll
7 years ago Sep 26, 2015 11:41am
Bryson Dunn
7 years ago Mar 01, 2016 2:53am
Carlos David Mosquera
6 years ago Mar 28, 2016 4:30am
Bryson Dunn
6 years ago Mar 28, 2016 6:31pm
Carlos David Mosquera
6 years ago Mar 28, 2016 9:28pm
Bryson Dunn
6 years ago Mar 28, 2016 10:48pm
Carlos David Mosquera
6 years ago Mar 28, 2016 11:48pm
Bryson Dunn
6 years ago Mar 29, 2016 12:06am
Carlos David Mosquera
6 years ago Mar 29, 2016 12:49am
Bryson Dunn
6 years ago Mar 29, 2016 1:29am
Bryson Dunn
6 years ago Mar 29, 2016 2:31am
Carlos David Mosquera
6 years ago Mar 29, 2016 3:27am
Bryson Dunn
6 years ago Mar 29, 2016 4:26am
Carlos David Mosquera
6 years ago Mar 29, 2016 4:46am
Bryson Dunn
6 years ago Mar 29, 2016 4:47pm
Carlos David Mosquera
6 years ago Apr 02, 2016 6:00am
Bryson Dunn
6 years ago Apr 04, 2016 9:59am
Alexander F
6 years ago Apr 18, 2016 11:06pm
Bryson Dunn
6 years ago Apr 19, 2016 9:54pm
Christofer Dutz
6 years ago Jul 26, 2016 12:25pm
Christofer Dutz
6 years ago Jul 26, 2016 1:49pm
Naresh B
4 years ago Mar 20, 2018 6:54pm

Hi ,

I am trying to use MediaElementPlayer version 1.3.3 with vaadin verion 8.1.0 but it is giving no such method exceptio.

the MediaElementPlayer version 1.3.3 component is working FINE with vaadin 7.7.3.

Can you pleASE suggest me how to execute in vaadin 8.