08-22-2012 02:01 PM
I am attempting to implement video recording and everything seems to be working pretty well now, except I can't get the video preview screen to be full size. I have tried all of the following:
1) _videoControl.setDisplaySize( Display.getWidth(), Display.getHeight() );
2) _videoControl.setDisplayFullScreen(true);
3) Creating a LayoutManager as per http://supportforums.blackberry.com/t5/tkb/article
My code, within my class that extends MainScreen, to display the video preview is as follows.
videoField = (Field) _videoControl.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field"); // _videoControl.setDisplayFullScreen(true); _videoControl.setDisplaySize( Display.getWidth(), Display.getHeight() ); _videoControl.setVisible(true); add(videoField); _player.start();
I have observed this behavior on 9330 simulator and phone and a 9930 phone. The 9330's use version 6.0 operating system and the 9930 uses 7.0.
Thanks in advance for any suggestions on how I might get the preview screen to be full screen.
08-23-2012 07:23 AM
Hi,
add video field in any manager and use sublayout method of manager to give width and height.....
08-23-2012 05:03 PM
Item #3 that I mentioned above does that and I tried it in a 2nd way without success.
1) For item #3, I created the LayoutManager class with the slight modification of putting x and y at 0.
public class LayoutManager extends Manager {
public LayoutManager() {
//construct a manager with vertical scrolling
super(Manager.VERTICAL_SCROLL);
}
//overwrite the nextFocus method for custom navigation
protected void sublayout(int width, int height) {
Field field;
//get total number of fields within this manager
int numberOfFields = getFieldCount();
// A vertical spacing of 50units is created
int y = 0;
int x = 0;
// Laying out every field in the manager evenly
for (int i = 0;i < numberOfFields;i++) {
field = getField(i); //get the field
setPositionChild(field,x,y); //set the position for the field
layoutChild(field, width, height); //lay out the field
}
setExtent(width, height);
}
}
Then I added it as follows, where fullScreenManager is an instance of LayoutManager:
videoField = (Field) _videoControl.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE,"net.rim.device.api.ui.Field"); // _videoControl.setDisplayFullScreen(true); _videoControl.setDisplaySize( Display.getWidth(), Display.getHeight()); _videoControl.setVisible(true); add(fullScreenManager); fullScreenManager.add(videoField); _player.start();
This left the video screen the same size as before, but now is starts in the upper left corner (before it was horizontally centered, though not vertically).
2) I also tried just adding videoField (using add(videoField) to my VideoScreen class (which extends MainClass and is therefore a Manager) and overriding SubLayout within that class. The SubLayout function through an error at setPositionChild stating that videoField was not a child of the manager.
Note also from my previous message that setDisplayFullScreen throws an exception stating that setDisplayFullScreen is not a supported operation, which results in a blank white screen.
08-25-2012 09:14 AM - edited 08-25-2012 09:15 AM
Hi,
You can use:
VerticalFieldManager vfm = new VerticalFieldManager(){
protected void sublayout(int width, int height) {
write code here and set width and height
}
};
vfm.add(videoField);
code is not tested in simulator....
08-28-2012 05:29 PM
Is their something that I am missing or doing wrong in the VerticalFieldManager (the only field I am adding to the manager is the video field):
private VerticalFieldManager vfm = new VerticalFieldManager(Manager.USE_ALL_WIDTH | Manager.USE_ALL_HEIGHT) {
protected void sublayout(int width, int height) {
setPositionChild(getField(0),0,0);
layoutChild(getField(0), width, height);
setExtent(width, height);
}
};
I have added it as a variable to a class that extends MainScreen. In that class, I do the following:
add(vfm); vfm.add(videoField);
For the 9330 simulator and phone, I get a video screen that takes up roughly 2/3 of the screen, horizontally centered and vertically starting at the top. For the 9650 simulator it is much closer to a full screen, with just a small strip at the top and bottom of the video preview screen. The 9930 is similar to the 9650 (both phone and simulator) except the top and bottom strips are larger.
08-29-2012 01:33 AM
Hi ,
I think you have wriiten correct code . bt in place of weidth use the screenweidth and in place of height use screen height.
Hope it will work!
08-29-2012 02:17 AM
Hi,
your code is correct just a little changes:
private VerticalFieldManager vfm = new VerticalFieldManager() {
protected void sublayout(int width, int height) {
setPositionChild(getField(0),0,0);
layoutChild(getField(0), width, height); //// in place of width and height use width //and heigh you want for video screen.....
setExtent(width, height); //same for here also
}
};
08-29-2012 10:46 AM
Thanks guys, but still no luck.
I did try setting the width and height to 320 and 240 respectively within the sublayout method, but that didn't work.
The reason I tried setting them directly is due to some debugging I did on both the 9330 simulator and device. I call _video.setDisplaySize(Display.getWidth(), Display.
That being said, I am not sure the 1073741823 is a problem as I get the same value with the 9650 simulator though the video preview screen is full size (my mistake in my previous message saying it wasn't quite full size). The 9930 simulator has the same 1073741823 value for the height, but the video preview screen, as mentioned before, is full width but not full height.
Is it possible that the 9330 and 9930 don't support a full screen video preview?