2

just another question:

I want to play an intro video when starting my app. It should be stretched to the display's width automatically. Unfortunately I don't know how to set the size and the position of the video. I place it into a Form but it occurs always on the top left corner and is not stretched to the display's width.

Is there a possibility to stretch it or even to place it in the middle of the display?

My code:

    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();
        }
    }

Kind regards.

Guzzer
  • 161
  • 5

0 Answers0