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:
Capture: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; }
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.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 } }
What's wrong?

Reply With Quote

