简体   繁体   English

在Silverlight中启用全屏模式时,如何单击视频?

[英]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种选择:

  1. 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函数。

  2. 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.

相关问题 全屏模式下如何全屏模式自定义视频播放器并向下滚动 - How to full screen mode custom video player and scroll down when full screen is on 单击全屏时如何隐藏默认的视频浏览器控件 - how to hide default video browser controls when click full screen 以全屏模式观看视频 - View video in full screen mode 在iOS / iPad上进入全屏模式时,如何停止HTML5视频播放器? - How to stop a HTML5 video player when it enters the full screen mode on iOS / iPads? 如何结合现有的全屏模式和视频暂停? - How to combine exisiting full screen mode and video pause? 如何在浏览器中以全屏模式播放图像或视频文件? - How to play image or video file in full screen mode in Browser? Python Selenium - 如何单击无框视频的全屏按钮 - Python Selenium - how to click full screen button of a video without a frame 禁用HTML5视频全屏模式 - Disable HTML5 video full screen mode React-Native-Video 如何在视频未全屏或不在屏幕时暂停视频 - React-Native-Video how to pause the video when video not in full screen or off the screen 如何在全屏模式下在视频(使用 Plyr.io)视频播放器上添加覆盖文本? - How to add an overlay text over video (using Plyr.io) video player on full screen mode?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM