Google+‎ > ‎Google+ Hangouts API‎ > ‎

GWT-Hangout Inside

All

use try{ }catch(Exception e){} to catch javascript error which make app stoped.
as possible as can copy paste from working apps.

Images

clear.cache.gif.

I'm not familiar with clear.cache.gif.so i'dont know how to avoid it.
anyway  "Failed to load resource :  app://334799408970/clear.cache.gif" crash app or hide widget when initialize.

So you can  call such kind method later with Timer class.usually ClientBundle call this.
Timer timer=new Timer(){
public void run(){
String imageUrl="http://www.xucker.jpn.org/test/resources/cat.png";
img = new Image(imageUrl);
}
}
timer.schedule(1000);

SECURITY_ERR

(SECURITY_ERR): SECURITY_ERR: DOM Exception 18
this error happens if you call canvas.toDataUrl() which canvas was painted by url image.
like this.

img = new Image("http://www.xucker.jpn.org/test/resources/cat.png");
canvas.getContext2d().drawImage(ImageElement.as(img.getElement()), 0, 0);
this case "http://www.xucker.jpn.org/test/resources/cat.png" is problem.
you should load image as data-uri.you can upload image via File API or small clientBundle image or load via server.

but you can set directly any url to Hangout-api method. like Av.setAvatar(Hangout.getParticipantId(), url);

ClientBundle

small image which converted to data-uri works fine.
but large image which not converted to data-uri will fail load.Failed to load resource  like app://334799408970/xxx.png.


Canvas

how to erase pictures.

transparent image is very usuful.Canvas is defaultly transparent.but sometime you need erase after drawing.
in such case you can do like this.

canvas.getContext2d().setStrokeStyle("rgba(0,0,0,0)");
canvas.getContext2d().setGlobalCompositeOperation("destination-out");
//erasing
canvas.getContext2d().fillRect(50, 50, 25, 25);

//set back default
 canvas.getContext2d().setGlobalCompositeOperation("source-over");

i know this tips via stackoverflow

Sound

most of things work fine as GWT.
but in my platform sound does not played well via Hangout.it means you can hear good sound ,but other user would hear only terrible compressed noise.



Css

technically it's not hangout topics but it's gadget topics.
make css file in public folder and load it from *.gwt.xml like this.(clientBundle will not work,this is best way)
  <inherits name="com.akjava.gwt.html5.Html5widget"/>
  <inherits name="com.akjava.gwt.lib.Commons"/>
      
  <stylesheet src="main.css"/>
</module>

but be careful,it's cached too much.if you modified css,clear cache or rename file.

Comments