Hi, I've been working on a code that plays a video using MMAPI. Now, I was able to play the video using the code snippet below;

try {
Player p = Manager.createPlayer("http://abc.mpg");
p.realize();
VideoControl vc;
if ((vc = (VideoControl)p.getControl("VideoControl")) != null)
vc.initDisplayMode(vc.USE_DIRECT_VIDEO, this);
p.start();
} catch (MediaException pe) {
} catch (IOException ioe) {
}

This code works, that is, it was able to display the video if the second argument to initDisplayMode is the class itself where this code is implemented. However, I want some of my canvas classes to be able to use the video class. And thus, on the second argument of initDisplayMode I passed a canvas reference of type 'MyOwnClass' which is a subtype of Canvas and this refers to the canvas where I want the video will be displayed. Is this correct? I mean, if you want another canvas to be able to display the video can you just make it as a second argument to initDisplayMode? For example;


public void play(Canvas canvasToDisplayVideo) {
try {
Player p = Manager.createPlayer("http://abc.mpg");
p.realize();
VideoControl vc;
if ((vc = (VideoControl)p.getControl("VideoControl")) != null)
vc.initDisplayMode(vc.USE_DIRECT_VIDEO, canvasToDisplayVideo);
p.start();
} catch (MediaException pe) {
} catch (IOException ioe) {
}
}

Can I do this? Is this correct? Cause when I tried it, the video was not shown, only the audio part was played.

Thanks!