Playing media with gwt

I have a simple mail system developed with GWT, and I'm trying to add a function to play audio and video files if there is a video or audio file as an application.

I am trying to use bst player and the HTML tag to work, but I cannot play some video formats like .avi, .mpeg, .mpg etc.

What else can be done to play such video formats?

On the other hand, I think about converting the video file to a Java servlet, and then I give this URL to the player, but I don't know if that makes sense. Should it be like that?

Last thing; Is there a common format (maybe .flv?) that you first need to convert the video file so that it can be played by VlcPlayerPlugin or another video player? Any other advice would be helpful.

Thanks for the help.

+1
source share
3 answers

Sorry for the delay, I did not have the opportunity to respond. Due to the fact that VlcPlayer behaved strangely and showed different control buttons on Ubuntu and Windows, I decided to use FlashPlayerPlugin from BstPlayer.I first convert the file to flv, using jave is described here in the documentation, then it serves for converted video to FlashPlayer. It works without problems now, thank you all for your help.

0
source

The html5 tag can play only certain formats. Here you can find a list of supported browser formats.

0
source

BST, , , :

public YoutubeVideoPopup( String youtubeUrl )
{
    // PopupPanel constructor takes 'auto-hide' as its boolean parameter.
    // If this is set, the panel closes itself automatically when the user
    // clicks outside of it.
    super( true );
    this.setAnimationEnabled( true );

    Widget player = null;
    try
    {
        player = new YouTubePlayer( youtubeUrl, "500", "375" );
        player.setStyleName( "player" );
    }
    catch ( PluginVersionException e )
    {
        // catch plugin version exception and alert user to download plugin first.
        // An option is to use the utility method in PlayerUtil class.
        player = PlayerUtil.getMissingPluginNotice( Plugin.Auto, "Missing Plugin",
            "You have to install a flash plaxer first!",
            false );
    }
    catch ( PluginNotFoundException e )
    {
        // catch PluginNotFoundException and tell user to download plugin, possibly providing
        // a link to the plugin download page.
        player = new HTML( "You have to install a flash plaxer first!" );
    }
    setWidget( player );
}

>

As you can see, we used the YouTube player here, which positively affects the fact that the video can be posted on YouTube and cannot be sent to the server every time the GWT application is redistributed. You can also play other Flash formats, just use the correct Player class in the try block; flash example:

player = new com.bramosystems.oss.player.core.client.ui.FlashMediaPlayer( GWT.getHostPageBaseURL( ) +
            f4vFileName, true, "375", "500" );
    player.setWidth( 500 + "px" );
    player.setHeight( "100%" );
0
source

Source: https://habr.com/ru/post/1726904/


All Articles