Skip to content Skip to sidebar Skip to footer

Playing Media With Gwt

I have a simple mail system developed with G.W.T and i am trying add a feature to play audio and video files if there is a video or audio file comes as an attachment. I have been

Solution 1:

the html5 video tag can only play certain formats. You can find a list of the supported browser formats here.


Solution 2:

I also had some problems with the BST player but at least it worked with the following code:

public YoutubeVideoPopup( String youtubeUrl )
{
    // PopupPanel's 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 has the positive effect that the vide can be placed at youtube and must not be pished to server every time the GWT app is redeployed. You also can play flash other formats, simply use the correct Player class in the try block; example for flash:

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

Solution 3:

Sorry for the delay, did not have the chance to reply.Because of VlcPlayer was behaving strange and showing different control buttons on Ubuntu and Windows, i decided to use FlashPlayerPlugin of BstPlayer.I first convert file to flv by using jave is described here in documentation, then it serves the converted video to FlashPlayer, it works without problem now , thank you all for your helps.


Post a Comment for "Playing Media With Gwt"