Paul
Paul

Reputation: 101

Capture pictues in blackberry application using VideoControl only works on emulator and not device

This is only some of the code because other parts of it are spread out but on the simulator for blackberry curve this adds a VideoControl to the manager and shows up fine with another button that actually captures the picture. However, when I run this on an actual Blackberry curve (version 6 I think) it doesn't display this on the screen.

try 
     {
         _p = javax.microedition.media.Manager.createPlayer("capture://video?encoding=jpeg&width=1024&height=768");
         _p.realize();
         _videoControl = (VideoControl) _p.getControl("VideoControl");

         if (_videoControl != null)
         {
             videoField = (Field) _videoControl.initDisplayMode (VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
          //   _videoControl.setDisplayFullScreen(true);
             _videoControl.setVisible(true);
            // EnhancedFocusControl efc = (EnhancedFocusControl)p.getControl("net.rim.device.api.amms.control.camera.EnhancedFocusControl");
            // efc.startAutoFocus();
             _p.start();


             if(videoField != null)
             {
                 add(videoField);
             }
         } 
     }
     catch(Exception e)
     {
         Dialog.alert(e.toString());
     }

Upvotes: 2

Views: 404

Answers (2)

Ray Vahey
Ray Vahey

Reputation: 3065

A lot of the time when things work on the emulator but not device it's permissions related, have you checked ApplicationPermissionsManager?

Word of warning, from OS4.5 to 6 a lot of stuff has been deprecated so be sure you check you have the right permissions for the models you are working with. e.g. ApplicationPermissions.PERMISSION_SCREEN_CAPTURE was deprecated in 4.6 I think.

Upvotes: 1

Vit Khudenko
Vit Khudenko

Reputation: 28418

In my experience the way of image taking you use has appeared very unreliable (it worked fine only on a limited number of devices), so I stopped using it. Use native Camera app instead - it works fine on all devices.

Upvotes: 2

Related Questions