Sunday, March 27, 2011

Re: Problem with JSNI

It seems that you have crossed method names in your code.

getElementsById() is not the same as getElementsByTagName()

Also getElementsByTagName() returns an array so you would want to do something like
elements = getElementsByTagName( 'embed' );

getElementsByTagName method returns the node list array of HTML document elements present in the HTML web page. You can pass the name of the particular HTML tag such as div, span, p etc whose list of array you want to collect. 

On Sun, Mar 27, 2011 at 9:35 PM, Sabbia <maestrosavia@gmail.com> wrote:
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.




--
-- A. Stevko
===========
"If everything seems under control, you're just not going fast enough." M. Andretti





--
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