×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Oct 2011
    Posts
    5

    Fullscreen proeview of camera image with CideoControl

    Hi all,

    I have recently tried to create an application that uses camera in Nokia N8 phone. The problem is that the camera is displayed in a small box (of size about of the "old phones" 320*240) even after setting the VideoControl.setDisplayFullScreen(true);.

    Is there a way in Java to get the preview of what camera is "seeing" in a full screen?

    I used the following tutorial: http://www.developer.nokia.com/Commu...ots_in_Java_ME

  2. #2
    Nokia Developer Expert
    Join Date
    Aug 2011
    Posts
    555

    Re: Fullscreen proeview of camera image with CideoControl

    Hi pacjent,

    Would it work, if you tried this sample code where you get the screen's width and height and then you set the display size as follows:

    Code:
    int canvasWidth = getWidth();
    int canvasHeight = getHeight();
    videoControl.setDisplaySize(canvasWidth, canvasHeight);

  3. #3
    Registered User
    Join Date
    Oct 2011
    Posts
    5

    Re: Fullscreen proeview of camera image with CideoControl

    Hi skalogir,

    I have tried the example you sent, but I have the same problem. The video preview is small. The On screen keyboard is displayed on the screen. When I use Nokia-MIDlet-On-Screen-Keypad: no, the keyboard is gone, but the preview window is still of the same (small) size. I would like to have the camera prewiev displayed as a full screen (just like it is displayed when you launch built-in camera software).

  4. #4
    Registered User
    Join Date
    Jun 2012
    Posts
    9

    Re: Fullscreen proeview of camera image with CideoControl

    Have you tried something like this:

    Code:
     
    videoControl = (VideoControl) player.getControl("VideoControl");
    Item item = (Item) videoControl.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, null);
    videoControl.setDisplayFullScreen(true);
    myForm.append(item);

  5. #5
    Registered User
    Join Date
    Oct 2011
    Posts
    5

    Re: Fullscreen proeview of camera image with CideoControl

    Hi saquas,

    Yes, I have. The Item is resized ot a fullscreen, but the video displayed on it is stillof the same size.
    Has anyone manage to display a full screen preview of a camera on Nokia N8? Is it possible, or maybe the API does not provide such features?

  6. #6
    Nokia Developer Expert
    Join Date
    Aug 2011
    Posts
    555

    Re: Fullscreen proeview of camera image with CideoControl

    Hi pacjent,

    I have managed to get a full screen video (with side bars at the top and bottom) with the following code on PureView 808 running Belle:

    Main MIDlet:
    Code:
    import javax.microedition.lcdui.Display;
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.midlet.MIDletStateChangeException;
    
    
    public class CameraMIDlet extends MIDlet {
        Display display;
        CameraCanvas canvas;
        protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
            // TODO Auto-generated method stub
    
        }
    
        protected void pauseApp() {
            // TODO Auto-generated method stub
    
        }
    
        protected void startApp() throws MIDletStateChangeException {
            display = Display.getDisplay(this);
            canvas = new CameraCanvas();
            canvas.setFullScreenMode(true);
            display.setCurrent(canvas);
    
        }
    
    }
    Supportive Canvas Class:
    Code:
    import java.io.IOException;
    
    import javax.microedition.lcdui.Canvas;
    import javax.microedition.lcdui.Graphics;
    import javax.microedition.media.Manager;
    import javax.microedition.media.MediaException;
    import javax.microedition.media.Player;
    import javax.microedition.media.control.VideoControl;
    
    
    public class CameraCanvas
        extends Canvas{
        
        Player player;
        VideoControl videoControl;
        
        CameraCanvas() {
            try {
                // Newer phones need to be initialized to image mode
                try {
                    player = Manager.createPlayer("capture://image");
        
                    // Older phones don't support this, so we start them
                    // in video mode.
                } catch (Exception ce) {
                    System.out.println("changing to capture video");
                    player = Manager.createPlayer("capture://video");
                }
                player.realize();
                
                player.prefetch();
                
                // Get VideoControl for the viewfinder
                videoControl = (VideoControl) player.getControl("VideoControl");
                if (videoControl == null) {
                    discardPlayer();
                    player = null;
                    System.out.println("VideoContro = null!");
                } else {
                    // Set up the viewfinder on the screen.
                    videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, this);
                    videoControl.setDisplayFullScreen(true);
                    player.start();
                    videoControl.setVisible(true);
                }
            } catch (IOException ioe) {
                discardPlayer();
                System.out.println("IOException: " + ioe.getMessage());
            } catch (MediaException me) {
                System.out.println("MediaException: " + me.getMessage());
            } catch (SecurityException se) {
                System.out.println("SecurityException: " + se.getMessage());
            }
        }
    
        // Stops the video player
        synchronized void stop() {
            if (player != null) {
                try {
                    videoControl.setVisible(false);
                    player.stop();
                } catch (MediaException me) {
                    System.out.println("MediaException: " + me.getMessage());
                }
            }
        }
        
        // this method will discard the video player
        private void discardPlayer() {
            if (player != null) {
                player.deallocate();
                player.close();
                player = null;
            }
            videoControl = null;
        }
    
        protected void paint(Graphics g) {
            // TODO Auto-generated method stub
            
        }
    
    
    }
    I also had to use this jad attribue: Nokia-MIDlet-On-Screen-Keypad: no

    I don't see why this won't work on N8. Can you try the above code and let us know if it works on your device?

Similar Threads

  1. Make camera fullscreen
    By felipelc in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2011-04-13, 06:44
  2. Replies: 7
    Last Post: 2009-05-30, 10:13
  3. n73 fullscreen camera odd behaviour
    By g_costanza in forum Symbian
    Replies: 2
    Last Post: 2009-04-05, 10:16
  4. Replies: 7
    Last Post: 2009-02-09, 09:36
  5. fullscreen camera viewfinder pyS60
    By amerkhan in forum Symbian
    Replies: 2
    Last Post: 2007-08-09, 14:06

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×