Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
alishaik786
Posts: 285
Registered: ‎08-26-2011
My Device: 9900

How to close the Camera which is open for video recording in CustomVideoRecording?

[ Edited ]

I create a custom videoRecording like this............

 

try
        {         
            player = javax.microedition.media.Manager.createPlayer("capture://video?" + encoding);
            player.start();

            videoControl = (VideoControl) player.getControl("VideoControl");
            recordControl = (RecordControl) player.getControl("RecordControl");            
            // Initialize the video display
            Field videoField = (Field) videoControl.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");                        
            try
            {
                videoControl.setDisplaySize( Display.getWidth(), Display.getHeight() );
            }
            catch( MediaException me )
            {
                // setDisplaySize is not supported
            }
            videoControl.setVisible(true);
            add(videoField);                     
            startRecord();
        }
        catch( Exception e ) // Dispose of the player if it was created
        {
            if( player != null )
            {
                player.close();
            }
            player = null;
        }

After this I called the stop record like this.....

 

 private void startRecord()
    {
        try
        {
        	recordControl.setRecordLocation(PATH);
        	_committed = false;
            recordControl.startRecord();
            _recording = true;                
        }
        catch( Exception e )
        {
            StartUp.errorDialog(e.toString());
        }
    }

There is no problem in simulator, but the problem is it doesn't work in device.

 

If I run the application it opens the camera and recording, when I want to stop recording it doesn't close the camera and stop the record and hang the device.

 

It is urgent requirement. 

If any one know help me?

 

 

=================================================================================
Feel free to click LIKE button if the solution helps you;
--
Regards,

ALI SHAIK.
Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,649
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: How to close the Camera which is open for video recording in CustomVideoRecording?

What BlackBerry Smartphone model and BlackBerry device software version are you testing on?  You can find this under Options, About on the BlackBerry Smartphone.

 

Do you see this behaviour with the VideoRecordingDemo included with the BlackBerry Java SDK and BlackBerry JDE?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
alishaik786
Posts: 285
Registered: ‎08-26-2011
My Device: 9900

Re: How to close the Camera which is open for video recording in CustomVideoRecording?

[ Edited ]

Thanks for Reply,

 

    I am using Blackberry 9780 divice (Version 6.0). Up to now also It works on simulator very nicely but what happend in the device I don't know. It opens the camera for video recording but it doesn't close and continues the recording(hang the device).

 

    I saw the VideoRecordingDemo included with the BlackBerry Java SDK and BlackBerry JDE that is also same condition. It doesn't close the camera.

   If anyone give the solution its great for me.

=================================================================================
Feel free to click LIKE button if the solution helps you;
--
Regards,

ALI SHAIK.
Please use plain text.
Developer
StevenKader
Posts: 644
Registered: ‎02-03-2010
My Device: Z10 LE

Re: How to close the Camera which is open for video recording in CustomVideoRecording?

[ Edited ]

Can you show us the code when you try and close the app?


Steven Kader at JaredCo
   Follow me on Twitter    |     Mipixi.com :  Web App for Photo Sharing
Please use plain text.
Developer
alishaik786
Posts: 285
Registered: ‎08-26-2011
My Device: 9900

Re: How to close the Camera which is open for video recording in CustomVideoRecording?

I wrote this below code to stop record:

 

private void stopRecord()
    {
        try
        {        	        	
            recordControl.stopRecord();
            recordControl.commit();                  
            _recording = false;           
            if (player != null) 
            {
        		player.close();
        		recordControl.reset();
            }            
        }
        catch( Exception e )
        {
        	StartUp.errorDialog("RecordControl#stopRecord() threw " + e.toString());
        }
    }

 

=================================================================================
Feel free to click LIKE button if the solution helps you;
--
Regards,

ALI SHAIK.
Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,649
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: How to close the Camera which is open for video recording in CustomVideoRecording?

Please try to run the VideoRecordingDemo and report if you have any errors.

 

What is the exact behaviour?  Does the application hang or continue recording?  Is any error or exception thrown?  Where are you saving the recorded video?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
alishaik786
Posts: 285
Registered: ‎08-26-2011
My Device: 9900

Re: How to close the Camera which is open for video recording in CustomVideoRecording?

I run the VideoRecordingDemo

 

1. The application hang or continue recording.

2. In device it woriking very nice. I getting problem in device. 

3. It doesn't thrown any exception.

4. I am saving file in "file:///SDCard/BlackBerry/videos"

 

 

=================================================================================
Feel free to click LIKE button if the solution helps you;
--
Regards,

ALI SHAIK.
Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,649
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: How to close the Camera which is open for video recording in CustomVideoRecording?

#1 and 2 contradict themselves.  Can you clarify what you are seeing?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
alishaik786
Posts: 285
Registered: ‎08-26-2011
My Device: 9900

Re: How to close the Camera which is open for video recording in CustomVideoRecording?

[ Edited ]

Thank you very much for your patient reply.

 

I run the VideoRecordingDemo

1. The application hang or continue recording.
2. In simulator it woriking very nice. I am getting problem in device.// I wrote here device instead of simulator(In last post.).
3. It doesn't thrown any exception.
4. I am saving file in "file:///SDCard/BlackBerry/videos"

 

I put my code in the following url :

 

http://pastebin.com/PGLX8EjL

 

After My record is completed. Then again I want to play the same record.

so After completing my record I am pushing next screen to play the saved file when user select the Play Record in MenuItem.(PlayVideoScreen(PATH,encodingFormat)).

 

My only problem is close the camera.

 

Again thanks for your Patience reply.

 

 

 

 

 

=================================================================================
Feel free to click LIKE button if the solution helps you;
--
Regards,

ALI SHAIK.
Please use plain text.
Developer
StevenKader
Posts: 644
Registered: ‎02-03-2010
My Device: Z10 LE

Re: How to close the Camera which is open for video recording in CustomVideoRecording?

Can you set all Permissions to ALLOW on device and try it again.


Steven Kader at JaredCo
   Follow me on Twitter    |     Mipixi.com :  Web App for Photo Sharing
Please use plain text.