[英]How to click on a video when full screen mode is on in silverlight?
I want to perform some operation when the user clicks on the video. 当用户单击视频时,我想执行一些操作。 When full screen mode is off, all things are working nicely but click event is not getting fired when full screen mode is on.
当全屏模式关闭时,所有情况都运行良好,但是在全屏模式下打开时,不会触发click事件。 Can anyone tell me why is it so?
谁能告诉我为什么呢?
Here is my code. 这是我的代码。
var obj = "<object id=\"video\" data=\"data:application/x-silverlight-2,\" type=\"application/x-silverlight-2\" width=\"" + width1 + "%\" height=\"" + height1 + "%\">" +
"<param name=\"onLoad\" value=\"pluginLoad\" />" +
"<param name=\"source\" value=\"player.xap\"/>" +
"<param name=\"initParams\" value=\"sourceurl=" + url + "\" />" +
"</object>";
and jQuery code is jQuery代码是
$("body").on("mouseup", "#video", function (){
console.log("clicked");
});
When I click on the video and full screen mode is off, "clicked" is getting printed but when full screen mode is on and I click, nothing is happening. 当我单击视频并关闭全屏模式时,将打印“单击”,但是当打开全屏模式并单击时,什么也没有发生。 Is something wrong with my code?
我的代码有问题吗?
Thanks 谢谢
You are dealing with two technologies here. 您在这里处理两种技术。 Your Web application (HTML, CSS, JS) contains an embedded video player in an HTML-Object element.
您的Web应用程序(HTML,CSS,JS)在HTML-Object元素中包含嵌入式视频播放器。 Whenever you click on that element, the defined click event will occur!
只要您单击该元素,就会发生定义的click事件! The content doesn't matter.
内容无关紧要。
If you switch to the "native" fullscreen mode of the plugin, you have left the context of your defined DOM click event. 如果切换到插件的“本机”全屏模式,则已离开定义的DOM click事件的上下文。
All your clicks must now be handled by your silverlight component via "managed code". 现在,您所有的点击都必须由Silverlight组件通过“托管代码”进行处理。
I think you have 2 options now: 我认为您现在有2种选择:
Use the Silverlight HTML bridge. 使用Silverlight HTML桥。 http://msdn.microsoft.com/en-us/library/cc645076(v=vs.95).aspx
http://msdn.microsoft.com/en-us/library/cc645076(v=vs.95).aspx
This means: Register your click events in the silverlight code and call the JS functions from there 这意味着:在Silverlight代码中注册您的click事件,然后从那里调用JS函数。
Use the HTML5 fullscreen mode ( https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode ) and stretch your silverlight component to a height and width of 100%. 使用HTML5全屏模式( https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode )并将您的silverlight组件拉伸到100%的高度和宽度。
Regards Rolf 问候罗尔夫
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.