PDA

View Full Version : Media Player Object Plugin & e_key



fcc
02-03-2004, 03:31 PM
Hi.

I have a problem, in a page (640x480 pixels) I insert the media player plugin (352x288 pixels), I used On_show event of the page for load and play the video, but the e_key on On_key event donīt work.

In the documentation you say that the video object have the focus in the Z_order, but my video object is more small that the page, that is to say, there is place so that the page has the focus, and activates the events On_key event.

what I can make to control the video with the keyboard?.

Another question.
In the video fullscreen mode, apparently returns to the normal video mode if one presses the key esc, I can I assign another key to this function?

thanks

Intrigued
02-03-2004, 06:41 PM
(Directed toward first question of yours)

[Edit] I put a MediaPlay object on my page and with the code suggestions here (tweaked to your project of course) should work, as it did for me! [/End Edit]

Let me explain how I handled the same sort of "setback" with e_Key events and Flash objects:

I first placed the Flash object (movie) in the spot on a page in my project where I wanted it.

Next, I put an Input box on that same page. (Needed one anyway).

Then on the Page's On Show event I put Page.SetFocus("ListBox1");.

Which led me to insert the following code into the Listbox's On Key event area:

if e_Key == 27 then
Flash.Stop("Flash1");
close = Dialog.Message("confirm", "Are you sure you want to quit this application?", MB_YESNO, MB_ICONQUESTION, MB_DEFBUTTON2);
if close == IDYES then
Application.Exit();
else
end
end

In conclusion:

When the Page "shows" (loads up) the Listbox object receives 'focus' and then is ready to receive the key press (if it ever comes from the user) of the ESC key (ASCII code # 27).

If the ESC key is pressed I have code to stop the Flash object from playing its 'movie'.

*Note: This stumped me longer than any other problem to date with concerns to AMS 5.0 (Pro). As the Flash movie (or it seemed) stopped e_Key events from 'firing'. I hope this helps you through your situation, if I understood it correctly.

Thank you for your patience.

fcc
02-03-2004, 09:40 PM
Hi, Intrigued

The problem is that the Media Player Object Plugin, doesn't have the on_key event.

however, the key was in your solution..

1) In a page (Page1) I insert the media player plugin (VideoPlugin1).

In the On Show event of Page1: I load the video file
MediaPlayer.Load("VideoPlugin1", _SourceFolder.."\\video.avi");

then I play the video.
MediaPlayer.Play("VideoPlugin1");

2) In the Media Player Plugin (VideoPlugin1).
that now is playing the video..
In the On Play event:

Plugin.SetVisible(this, true);

And now the solution...
return the focus to the page1

Page.SetFocus("Page1");

and now I have the On key event available of the Page1 for control the MediaPlayer, for example.

In the On key event of the Page1
if e_Key == 96 then
MediaPlayer.Stop("VideoPlugin1");
end

thanks for your help.

Intrigued
02-04-2004, 10:13 AM
I am glad this helped to find a proper solution.

Don't forget to check in to using:

MediaPlayer.SetFullScreen

...with a e_Key event for the second question you posted!

fcc
02-16-2004, 03:42 PM
Hi.

I Try to return from the fullscreen mode, but it looks like that the only way is to press the esc key.
I am using a remote control (streamzap), and I cannot assign to the key esc to him.
I thought about modifying the size of the object video, in order to simulate the size they fullscreen.
the idea is to use the page of bottom with black color with a size of for example 640x480 pixels, and change to the size of the object video to 640x470 pixels, this way it would be left an area of the page that could receive the events on key.

I tried to do this with: Plugin.SetSize("Movie1", 640, 480); where Movie1 is the name of the media player object plugin, but I have not obtained any result.
there is some way to solve this?

Thanks