04-28-2010 10:13 AM
I'm one of the developers of the LWUIT framework. We have a great native RIM API port of LWUIT which runs really well and in quite a few production applications e.g.: http://lwuit.blogspot.com/2010/04/musix-on-blackbe
It supports touch pretty well including support for the Storms click screen functionality, tensile/kinetic drag etc.
We have video related issues in our issue tracker and its somewhat stumped me on how these issues can be fixed (both seem to be the same issue):
https://lwuit.dev.java.net/issues/show_bug.cgi?id=
https://lwuit.dev.java.net/issues/show_bug.cgi?id=
This link:
http://www.blackberry.com/knowledgecenterpublic/li
Essentially claims that "USE_DIRECT_VIDEO" Isn't supported for Field items in the RIM API's... We use this constant and it does seem to work even in a field. I can't think of a possible way to change it since we handle all of our own drawing and this might collide with another component added on top.
Did we get the architecture "completely wrong" for RIM?
You can see the full source code for LWUIT here:
https://lwuit.dev.java.net/source/browse/lwuit/
You can see how we implemented the native RIM port here, the main method of concern is getVideoControl() although we might need a major architectural change as a result of changing this:
Tips on how to embed a video into a double buffered field in a way that is portable between RIM devices/OS's would be appreciated.
Thanks.
04-28-2010 08:15 PM - edited 04-28-2010 09:42 PM
Judging by the error that https://lwuit.dev.java.net/issues/show_bug.cgi?id= 230 said they got, canvas.getDelegate() is either returning null or something that is not a LCDUI Canvas object.
I looked around and couldn't find the getDelegate() function so couldn't go any further.
Edit: https://lwuit.dev.java.net/issues/show_bug.cgi?id= 278 says that getDelegate() returns "net.rim.device.api.ui.container.TitleStatusManage
Edit 2: Just realized that getDelegate() is a MainScreen function. In the simplest sense, getDelegate() returns type net.rim.device.api.ui.Manager, this is neither a Canvas nor a subclass of it. There's your problem.
Solution? You can try to use a Field (by using USE_GUI_PRIMITIVE) but that might not be compatible in the context of LWUIT, you can also try to wrap the Manager in a Canvas and simply pass the actions in Canvas to the Manager.
I'm really not sure but your problem is the getDelegate() function since it returns an incompatible type.
04-28-2010 11:31 PM
Thanks for the reply.
I failed to mention that we tried both the canvas variable (which is a MainScreen) and its delegate.
We can't use an LCDUI Canvas since this is a native RIM application and these just don't offer the same integration on a blackberry device.
The problem is that I can't easily work with a Field object since we paint the entire screen using a double buffer. Regardless this will require some complex manipulation and management of that field that would need some major changes to LWUIT and might not even be possible.
Problem is that video works for me even on devices without that so I'm not sure if we should go to all that trouble which might not even work.
04-29-2010 06:47 AM
That function actually works for you?
In that case the people who have the issue might be replacing the default Manager for the MainScreen and that might be incompatible.
04-29-2010 08:04 AM
It works for me personally for video playback on the devices I tested.
Naturally it might not work on some devices and users have complained in two instances (listed above).
What I'm looking for is this:
Should I try to rewrite the code using the version of the method that returns a Field?
Will this work for me if I'm constantly drawing an image over the MainScreen (double buffering)?
04-29-2010 08:19 AM - edited 04-29-2010 08:23 AM
If you don't set the delegate and it works for you then see what those who logged the bugs are doing, if they are not changing the delgate then I have no clue. If they are then that's your problem, you could add a check to see if the degelage is a valid type:
public Object getVideoControl(Object player) {
Manager man = canvas.getDelegate();
//Make sure that the delegate is a valid type.
if(!(man instanceof javax.microedition.lcdui.Canvas))
{
System.err.println("Non-compatable Canvas, returning null");
return null;
}
VideoControl vidc = (VideoControl)((Player)player).getControl("VideoCo ntrol");
vidc.initDisplayMode(VideoControl.USE_DIRECT_VIDEO , man);
return vidc;
}
Double-buffering shouldn't be a problem.