2

I have to play a video in my C# program and I have to make it so that users can't interact with it, since the PC will be set in a public area.

I tried unchecking Enable Control and I also set uiMode to 'none', but CTRL+P (Pause) still works. This makes me think that other hotkeys do as well.

How can I set it so that you can't do anything with the video?

Edit:

I'm using Winforms, because it seems to be easier. I'm not really a C# developer, I have 0 experience and it resembles VB back from school.

vahid abdi
  • 9,636
  • 4
  • 29
  • 35
Martin Fejes
  • 677
  • 12
  • 20
  • you can't. these are embedded within the object itself. you could try to capture the key events however this probably wont work as they would be focusing on the form input itself and not the player input. instead, you should look for another player that gives you the flexibility to do this. WMP was never designed for these types of things where input is completely blocked. – Ahmed ilyas Feb 24 '14 at 08:58
  • @Ahmedilyas Are you sure? If so, what other options are there? I'm not very familiar with these things. (Or C# in general.) – Martin Fejes Feb 24 '14 at 09:02
  • yes I am sure. it is not C# specific but rather the WMP component. – Ahmed ilyas Feb 24 '14 at 12:05

2 Answers2

2

In case you are developing WPF application, there is MediaElement you can use. It doesn't have any control for user interaction. Developer has to built it manually using buttons, progress bar, etc in case he need to provide control for user interaction.

And the usage is very straightforward :

<MediaElement Source="path_to_video-file.mp4" />

For reference :

  1. Sample Application in MSDN
  2. http://www.wpf-tutorial.com/audio-video/playing-video/

PS: It turns out that you are developing winform apps instead of WPF. In case this option still interesting for you to try, you can use ElementHost to embed WPF control in winform.

This is one of many tutorials available on net about how to use ElementHost control : http://tech.pro/tutorial/799/wpf-tutorial-using-wpf-in-winforms.

har07
  • 88,338
  • 12
  • 84
  • 137
0

Have you tried putting another transparent WINDOW in front of the media player (area only if needed). While not totally befinner level, that is not exactly super science either.

As WINDOWS can go in front, that should block any interaction with the media player while - due to transparency - still showing the video.

MAybe even a control works (panel with nothing on it), but given that media player is a native control it may be needed to hide it behind a transparent window.

WOuld help to know what UI technology you use.... Winforms or WPF.

TomTom
  • 61,059
  • 10
  • 88
  • 148
  • I'm using Winforms. Placing something before the object seems to work, but I can't find anything that is see-through when made transparent. Panel and label is showing only the background and not the content behind. – Martin Fejes Feb 24 '14 at 09:17