Sunday, March 27, 2011

Problem with JSNI

Hello!!

It's been days trying to solve my problem, but I've got a great mess
in my head... The thing I wanna do is integrate DivXPlus Web Player
plugin in my GWT project. In order to get it, I must add these lines:

String videoStr = "<object id='ie_plugin' name='ie_plugin'
classid='clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616' width=636
height=380 codebase='http://go.divx.com/plugin/
DivXBrowserPlugin.cab'>";

videoStr = videoStr.concat("<param name='src' value=\"videos/
origen.avi\" />");

videoStr = videoStr.concat("<embed id='ff_plugin' name='ff_plugin'
type='video/divx' src='videos/origen.avi' custommode='none'
mode='mini' width='636' height='380' pluginspage='http://go.divx.com/
plugin/download/
'>");
videoStr = videoStr.concat("</embed>");
videoStr = videoStr.concat("</object>");

HTML vid = new HTML();
vid.setHTML(videoStr);
videoLabel.addChild(vid);
resultsLayout.addMember(videoLabel);

mute(); //here is the problem


This is working. But the DivX plugin offers some Javascript methods to
control the playing. It would with this script, for example, to make
"mute" to the video:

<script>
function mute(){
plugin = document.getElementById('ff_plugin');
plugin.Mute();
}
</script>

So, I've tried to convert these lines to JSNI:

native void mute() /*-{
plugin = $doc.getElementsByTagName('ff_plugin');
plugin.Mute();
}-/*;

But I get an UmbrellaException. So, no doubt my problem is with JSNI,
but I'm reading thousands of documents but I can't still make it work.
Please, I really beg your help, my time's ending and I can't find the
solution.

Thanks in advance

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment