Friday, 15 April 2011

Playing youtube video in vaadin MediaComponent(Mediaelementjs Player add on) -


I am trying to run YouTube video in Wadian MediaContent. What I did

  External resources external resource = new external resource (format URL (url)); ExternalResource.setMIMEType (MediaComponent.Type.VIDEO.name () toLowerCase ().); MediaComponent videoPlayer = New MediaComponent (MediaComponent.Type.VIDEO); VideoPlayer.SsetWidth (665.0F, Unit PIXELS); VideoPlayer.setHeight (465.0 F, Unit PIXELS); VideoPlayer.setSource (externalResource); VideoPlayer.play (); CssLayout.addComponent (VideoPlayer);  

If I define any other URL, i.e. new external resource ("pathToMp4.mp4") it works perfectly. So, what is "special" about youtube video? Any suggestions what am I doing wrong?

Cheers, Simon

The MP4 file is a real video provided by the Vaudine Media Can be converted to a stream played by the player. If you have tried to run a YouTube video URL, then probably a URL of the YouTube page has been used, where the video is embedded, which is not the same and in any stream to use it with the Video Media Player Can not be changed.

You can either embed actual YouTube videos on your web page or use specially designed vaadin add-ons to play YouTube videos:

  https://vadin.com/directory#addon/youtubeplayer: Vaadin  

The YouTube player component integrates the YouTube video player into the wadin app

Server-side APIs have all standard playback controls: Q, Play, Pause, Stop, Search, Volume, Mute and Quality, as well as state, quality, error callback. Supports both "chrome" and "embedded" mode.

When you need better programmatic playback control than the default embedded YouTube player, then use this YouTube player. Check out the interactive demo app.


No comments:

Post a Comment