MediaPlayer control - questions


Walter Hiller

Hello,

I just finish my work on my teaching app and now found some interesting questions related to the MediaPlayer control:

1. Is there a way to toggle the MediaPlayer.control from True/False. I tried to set the var MediaPlayer1.Control but no success.
2. Is there a way to block the right mouse click options on the player? Means show URL, download video etc. This si important to protetc movies ( just a bit) against simple downloading

Thanks in advance
Walter


DecSoft

Hello Walter,

About the first question I don't understand what "True/False" means in this scenario. Do you want to disable it or what? Please explain me little more.

About the second question, as you say, disable the context menu help just a bit for downloading the video. If the user is a little smart, probably they can always access the video source. Maybe we can complicate the things from the webserver, but, to be honest, at this moment I can't imagine a way, since our apps running on the client and their source is available, even when minimized and obfuscate it.

Anyway I update App Builder in order to add some stuff related with this second question. I add to the Event's category the new PreventDefault action, and, also add a "ContextMenu" event to the app views and also to the Media Player control. Now we can prevent the browser contextual menu by using the PreventDefault action into the Media Player ContextMenu event in the below way:

We can prevent the context menu for an entire app view or an specific control by using the ContextMenu app view event, for example, the below code into such event prevent the context menu for the entire app view:

We also can disable the context menu for an specific control, for example, a "Button1", using the same ContextMenu app view event in this way:

Then what is the reason we can't use this approach to prevent the contextual menu in the Media Player event? Because the "target.id" of the app view Event variable are empty in this case and we need to deep into the Event object to properly access the Media Player name or ID. So I decide to put a ContextMenu event specifically to be used by the Media Player control.

Hope this can be useful for you, but, if you have any question don't hesitate to post here.



Walter Hiller

Hello David,
back again from a longer illness and holidays now I redesign some things in my WebApp. One of these things is the MediaPlayer. I cancel all Flashplayer activities and use your MediaPlayer again. And there I have still the question of hiding the native MediaPlayers controls for Play-Pause,Slider, Fullscreen etc. .
My idea is to activate the controls on design time, on run time controls should hide after i.e 3 seconds and be reactivated/shown again if needed > i.e. by setting a var like MediaPlayer1.controls=true/false. I also tried SetStyle "MediaPlayer1" "controls" "false" but was´nt successfull.

Thanks for your answer
Walter


DecSoft

Hello Walter,

Glad to see you! Hope your holidays are good. Well. In principle the MediaPlayer.Controls variables can only be used at designtime, that is, to determine if the MediaPlayer must shown the controls or not. Here we have the option to "hide" the controls included by the MediaPlayer and use our own controls and the appropiate actions to play, pause, stop, etc.

Anyway, I update right now the program in order to allow us to shown the MediaPlayer controls and then hide/show also in runtime. But this cannot be made using the MediaPlayer.Controls variable, which continue available to set only in designtime. The App Builder recent update identify now the MediaPlayer controls container, and therefore we can hide/show in runtime using a code like this in order to get your expected behaviour:

A couple of things must be considered here: firstly we can see the "MediaPlayer1Controls" identifier, which we must use with the "GetStyle" and "SetStyle" actions. The identifier is composed with the name of the control (MediaPlayer1 in this case) suffixed by "Controls". Secondly, to allow the above code to work propertly, the MediaPlayer.Controls variable must be "true", because, at this time, App Builder do not include the HTML markup for the controls if we put "false" in that variable.

Update your copy of App Builder now, Walter, play it, and tell me if this can help you or not.



DecSoft

Hello again,

The MediaPlayer control do not include certain events that may can be useful to get your desired behaviour, then right now I add to the MediaPlayer control the Click, DblClick, MouseUp, MouseDown, MouseEnter and MouseLeave events.

Hope these events can be useful to you Walter, and also to other people.



DecSoft

Hello again,

The above code can continue use like that without problems, however, two new actions has been added to App Builder: MediaShowControls and MediaHideControls, which can be used to show or hide the MediaPlayer controls respectively. Note that the designtime "Controls" variable of the "MediaPlayer" must be "true" to allow these actions to work.


Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.