×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Sep 2011
    Posts
    1

    Image capture on some Nokia phones

    Hi all
    I have a problem with image capture on following devices:
    Nokia 5130 xpress music
    2690,nokia
    Spice-m6460
    Nokia x2-00
    C1-01 Nokia
    Nokia 2370

    This is my code:
    Start player:
    Code:
    private Object startPlayer() throws IOException, MediaException {
    
            Object item = null;
            try {
    	    String supportedDevices = (String) System.getProperty("camera.resolutions");
    	    String[] resolutions = Utils.split(supportedDevices, ' ');
    	    String[] device = Utils.split(resolutions[0], ':');
    	    String phoneDefaultCamera = device[0].trim();
    	    m_locator = "capture://" + phoneDefaultCamera;
                m_objPlayer = Manager.createPlayer(m_locator);
                m_objPlayer.realize();
            } catch (Exception e) {
                e.printStackTrace();
    	    m_locator = "capture://video";
                m_objPlayer = Manager.createPlayer(m_locator);
                m_objPlayer.realize();
            }
    
            m_objVideoControl = (GUIControl) m_objPlayer.getControl("GUIControl");
            if (m_objVideoControl != null) {
    	    try {
    		item = m_objVideoControl.initDisplayMode(GUIControl.USE_GUI_PRIMITIVE, null);
    		if(item == null || (item instanceof Item))
    		    item = m_objVideoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, null);
    		m_objPlayer.prefetch();
    	    } catch (Exception e) {
    		e.printStackTrace();
    		// Quirk for Blackberry
    		item = m_objVideoControl.initDisplayMode(GUIControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
    		m_objPlayer.prefetch();
    	    };
    
                return item;
            }
            return null;
        }
    Capture:
    Code:
    byte[] data = null;
    	String phoneDefaultEncoding = "";
    	String preferredEncoding = PREFERRED_IMAGE_ENCODING;
    	try {
    	    String supportedFormatStr = (String) System.getProperty("video.snapshot.encodings");
    	    if (supportedFormatStr != null) {
    		String[] formats = Utils.split(supportedFormatStr, ' ');
    		phoneDefaultEncoding = formats[0].trim();
    	    }
    	    try {
    		try {
    		    // First try to get snapshot in format we prefer
    		    m_snapshot = preferredEncoding + "&width=640&height=480";
    		    data = ((VideoControl) m_objVideoControl).getSnapshot(m_snapshot);
    		} catch (MediaException me) {
    		    // Workaround for phones with rotaded by 90 deg camera
    		    m_snapshot = preferredEncoding + "&width=480&height=640";
    		    data = ((VideoControl) m_objVideoControl).getSnapshot(m_snapshot);
    		}
    	    } catch (MediaException me0) {
    		// Can't get snapshot in preferred format, so, use phone default
    		// TODO: use getSourceHeight()/getSourceWidth() to determine image ratio
    		preferredEncoding = phoneDefaultEncoding;
    		try {
    		     m_snapshot = preferredEncoding + "&width=640&height=480";
    		    data = ((VideoControl) m_objVideoControl).getSnapshot(m_snapshot);
    		} catch (MediaException me) {
    		    // Workaround for phones with rotaded by 90 deg camera
    		     m_snapshot = preferredEncoding + "&width=480&height=640";
    		    data = ((VideoControl) m_objVideoControl).getSnapshot(m_snapshot);
    		}
    	    }
    	} catch (Exception m) {
    	    // Last try
    	    try {
    		 m_snapshot = preferredEncoding;
    		data = ((VideoControl) m_objVideoControl).getSnapshot(m_snapshot);
    	    } catch (Exception e) {
    		//This is the end
    	    }
    	}
    We have a lot of users worldwide and try to support as many phone models as possible. But currently we experiencing problem with these models.
    What's wrong?

  2. #2
    Nokia Developer Expert
    Join Date
    Aug 2007
    Posts
    1,595

    Re: Image capture on some Nokia phones

    Hello maranoid,

    and welcome to Nokia Developer Discussion Boards!

    Could you clarify more in detail about what kind of problem are you experiencing with the affected devices?

    Regards,
    r2j7
    [URL="http://library.forum.nokia.com/java"][B] >>> Java Developer's Library <<<[/B][/URL]
    [URL="https://www.developer.nokia.com/Resources/Support/Technical_support.xhtml"] [B]>>> Technical Support for Java ME development <<<[/B][/URL]
    [URL="https://publish.ovi.com/info/"][B]>>> Nokia Publish: reach millions of Nokia users worldwide through Nokia Store <<<[/B][/URL]

  3. #3
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: Image capture on some Nokia phones

    As r2j7 said, more details are needed.
    My first guess is related to the capture locator. On Series 40 phones (at least on older models) the correct one for snapshots is capture://image
    http://library.developer.nokia.com/t...A70BE8AF1.html

    Hartti

Similar Threads

  1. image capture on s40 nokia 6212
    By gowribalaguru in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2010-07-16, 05:34
  2. [moved] Capture image using capture://image or capture://video
    By bilal.lodhi in forum Mobile Java General
    Replies: 2
    Last Post: 2009-07-11, 12:20
  3. Burst image capture in Nokia N95
    By ydon in forum Symbian
    Replies: 9
    Last Post: 2008-11-26, 04:30
  4. Which Nokia phones have supports.video.capture=true ?
    By Steel_BRS in forum Mobile Java Media (Graphics & Sounds)
    Replies: 10
    Last Post: 2008-06-30, 18:12
  5. how to capture image from 3G phones camera
    By piotridzikowski in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2008-06-05, 17:50

Posting Permissions

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