我需要一个视频屏幕,在视频播放下,我想显示如下两行文字。
为此,我正在使用以下代码。
public final class PlayVideoScreen extends MainScreen {
private Player player;
private VideoControl videoControl;
public PlayVideoScreen() {
// ms.setTitle(new LabelField("Let's play some video..."));
LabelField lf = new LabelField("Video Play");
try {
// Create a new Player pointing to the video file.
// This can use any valid URL.
player = javax.microedition.media.Manager
.createPlayer("file:///SDCard/BlackBerry/videos/sample.avi");
player.realize();
// Create a new VideoControl.
videoControl = (VideoControl) player.getControl("VideoControl");
// Initialize the video mode using a Field.
Field videoField = (Field) videoControl.initDisplayMode(
VideoControl.USE_GUI_PRIMITIVE,
"net.rim.device.api.ui.Field");
add(videoField);
VolumeControl volume = (VolumeControl) player
.getControl("VolumeControl");
volume.setLevel(30);
player.start();
// Set the video control to be visible.
// videoControl.setVisible(true);
} catch (MediaException me) {
Dialog.alert(me.toString());
} catch (IOException ioe) {
Dialog.alert(ioe.toString());
}
add(lf);
LabelField lf2 = new LabelField("How r you?");
add(lf2);
}
public boolean onClose() {
// Clean up the player resources.
player.close();
videoControl.setVisible(false);
close();
return true;
}
}
现在可能是视频的高度,视图正在滚动,文本仅在滚动后可见。我正在使用屏幕尺寸为 320X240px 的设备。我什至用 320X150px 的视频进行了测试。但是如果没有滚动,文本是不可见的,尽管视频的上方和底部有很多可用空间。我的代码有什么问题?如何解决?