別の質問:
アプリの起動時に紹介ビデオを再生したい。ディスプレイの幅に自動的に引き伸ばされます。残念ながら、ビデオのサイズと位置を設定する方法がわかりません。フォームに配置しますが、常に左上隅に表示され、ディスプレイの幅に引き伸ばされません。
それを伸ばしたり、ディスプレイの真ん中に配置したりする可能性はありますか?
私のコード:
String MEDIA_FILE_NAME = "/demo.mpeg";
String MEDIA_MIME_TYPE = "video/mpeg";
Media mVideo;
public Video() {
form = new Form();
form.show();
try {
InputStream is = Display.getInstance().getResourceAsStream(getClass(), MEDIA_FILE_NAME);
mVideo = MediaManager.createMedia(is, MEDIA_MIME_TYPE, new MediaCompletionListener());
form.setLayout(new BorderLayout());
Component videoComp = mVideo.getVideoComponent();
form.add(BorderLayout.CENTER, videoComp);
mVideo.setFullScreen(true);
mVideo.play();
} catch (IOException e) {
Label label = new Label("Not supported.");
form.getContentPane().setLayout(new BorderLayout());
form.getContentPane().add(BorderLayout.CENTER, label);
form.repaint();
}
}
敬具。