chunxiao9812 / bst-player

Automatically exported from code.google.com/p/bst-player
0 stars 0 forks source link

Make API flexible to permit addition of new plugins by 3rd parties #47

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Currently the API is tightly coupled which makes addition of new plugins 
cumbersome.  There should be a way to make the API more flexible.

Ref: 
http://groups.google.com/group/bst-player/browse_thread/thread/ddb9eefbadd9ab7d?
hl=en-GB

Original issue reported on code.google.com by sbrah...@gmail.com on 26 Apr 2011 at 9:50

GoogleCodeExporter commented 9 years ago
In looking at it I think a visitor pattern is in order to prevent a switch 
statement. It'll create a little bit of superfluous code because of the fall 
throughs and default values in place in the switch statements but a shared 
method should take care of most of that.

Original comment by cth...@gmail.com on 27 Apr 2011 at 3:30

GoogleCodeExporter commented 9 years ago

Original comment by sbrah...@gmail.com on 27 Apr 2011 at 2:54

GoogleCodeExporter commented 9 years ago
Latest 1.3-SNAPSHOT in maven repo contains an alpha-version of this feature.

Simple steps to integrate custom player/plugin wrappers:
- Implement custom player by extending AbstractMediaPlayer and provide custom 
implementation as required
- Implement the com.bramosystems.oss.player.core.client.spi.PlayerWidgetFactory 
interface.  The implementation is called via deffered binding, so browser 
specific implementations are also supported with GWT type-replacement
- Annotate the custom player with the @Player annotation: 

@Player(name="NameOfCustomPlayer", 
widgetFactory=YourPlayerWidgetFactoryImpl.class, 
minPluginVersion="<major>.<minor>.<revision>")
* name: is used to associate mime-types to your player as 
"plugin.NameOfCustomPlayer" (@see 
http://oss.bramosystems.com/bst-player/dynamic-players.html). Other uses may 
come later
* minPluginVersion: is the minimum version of the media plugin required by your 
player.  The widgetFactory will be consulted for the detected plugin version.

With this your custom player is also available as a dynamic player.

I am still looking into other features that may follow this:
- automatic UiBinder integration: so custom players can also be used with 
UiBinder out-of-the-box
- automatic javascript export: so custom players can be used in non-GWT apps.

give these steps a try and waiting for your feedback.

Original comment by sbrah...@gmail.com on 4 May 2011 at 5:04

GoogleCodeExporter commented 9 years ago
I will give this a try in the next couple weeks (I've been shifted onto other 
priorities) and get you feedback.  Thanks for the quick response!

Original comment by cth...@gmail.com on 4 May 2011 at 9:21

GoogleCodeExporter commented 9 years ago
Ref: http://oss.bramosystems.com/bst-player/custom-plugin.html

Original comment by sbrah...@gmail.com on 10 Aug 2011 at 7:13