Вопрос

I'm trying to implement remote control of a device that supplies an RTSP video stream and a remote control protocol. I started off with the sample code in How can I display an RTSP video stream in a web page?:

<OBJECT classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921"
     codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab"
     width="640" height="480" id="vlc" events="True">
   <param name="Src" value="rtsp://cameraipaddress" />
   <param name="ShowDisplay" value="True" />
   <param name="AutoLoop" value="False" />
   <param name="AutoPlay" value="True" />
   <embed id="vlcEmb"  type="application/x-google-vlc-plugin" version="VideoLAN.VLCPlugin.2" autoplay="yes" loop="no" width="640" height="480"
     target="rtsp://cameraipaddress" ></embed>
</OBJECT>

Then added a snippet of Hammer.js to show an alert when I click on the page:

var element = document.getElementById('test_el');
    var hammertime = Hammer(element).on("tap", function(event) {
        alert('hello!');
    });

I find that the alert appears when I click to the side of the VLC ActiveX control, but not on it. I'm guessing that the ActiveX control is consuming the touch event before Hammer.js gets to see it? Is there any way of either turning off the UI in VLC (the pause/play button, volume control, etc) so it doesn't consume touches or get Hammer.js to see the touches as well? Or am I completely wrong and it's another problem?

Это было полезно?

Решение

Turns out that VLC example is a bit out of date - see the WebPlugin documentation. I can update the HTML to:

<embed type="application/x-vlc-plugin" pluginspage="http://www.videolan.org"
     windowless="True"
     width="640"
     height="480"
     src="rtsp://192.168.0.10/screenmirror"
     id="vlc">
</embed>

The key is the "windowless" flag, defined as:

Draw the video on a window-less (non-accelerated) surface and allow styling (CSS overlay, 3D transformations, and much more). Default: false

Once I apply this the VLC UI disappears, Hammer.js seems to work fine and my alert appears when I click the video.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top