WPF中缺少MediaElement标记

编程入门 行业动态 更新时间:2024-10-27 19:29:36
本文介绍了WPF中缺少MediaElement标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我看到MediaElement上有一个Markers属性,但这似乎可用于Silverlight MediaElement,而不是WPF MediaElement?

I see that there is a Markers Property on the MediaElement, but this seems to be available to the Silverlight MediaElement, not the WPF MediaElement?

您能帮我解决我所缺少的吗?

Can you help me with what I'm missing?

我正在尝试将标记添加到WPF MediaElement,以播放视频并根据时间轴显示弹出窗口.我应该使用什么来代替丢失标记"集合?

I'm trying to add Markers to a WPF MediaElement, to play a video and show popups based on the timeline. What should I be using in place of the Missing Markers collection?

谢谢您的帮助.

推荐答案

根据您的实际意图,您的问题有两个方面-请注意, MediaElement.Markers属性是只读 与当前加载的媒体文件关联的时间轴标记的集合:

There are two aspects to your question depending on what you actually intended - please note that the MediaElement.Markers Property is a read only collection of timeline markers associated with the currently loaded media file:

这是 TimelineMarker类:

时间轴标记是与媒体文件中特定点关联的元数据.这些标记通常是提前创建的,并存储在媒体文件本身中.它们通常用于命名视频中的不同场景或提供脚本提示.通过处理MediaElement对象的MarkerReached事件或访问MediaElement对象的Markers属性,可以使用时间轴标记[...]

A timeline marker is metadata associated with a particular point in a media file. These markers are usually created ahead of time and stored in the media file itself. They are typically used to name different scenes in a video or provide scripting cues. By handling the MediaElement object's MarkerReached event or by accessing the MediaElement object's Markers property, you can use timeline markers [...]

因此,时间轴标记可能非常适合于对弹出窗口进行编码,但是需要注意的是,它们是媒体文件本身的属性,而不是典型的媒体播放器时间轴小部件上的图形刻度的集合!

So timeline markers may be a good fit for encoding your popups, but it is important to note that they are a property of the media file itself and not the collection of graphical tick marks on the typical media players timeline widget!

我现在可以找到的唯一总结一下的文章是如何在史蒂文·波特(Steven Porter)的Silverlight和WPF中对视频标记进行编码以供消费. (不要被注册需求所愚弄,连字符站点的臭名昭著的技术首先激发了Stack Overflow的创建,例如,您无需注册就可以阅读这篇文章,保持向下滚动.)

The only article summarizing this I could find right now is How to encode video markers for consumption in Silverlight and WPF from Steven Porter. (Don't get fooled by the registration demand, it's the infamous technique from the evil hyphen site that motivated the creation of Stack Overflow in the first place, i.e. you can read the article just fine without registering, just keep scrolling down.)

假设这是您实际上要实现的目标,以及为什么偶然发现 MediaElement.Markers 集合的答案是自己动手:

Assuming this is what you're actually trying to achieve and why you stumbled over the MediaElement.Markers collection the answer is roll your own:

这非常简单,基本上,您将需要自定义滑块控件,请参见如何使用滑动器类文档. ticks.aspx"rel =" nofollow noreferrer> Ticks 属性可沿滑块以不规则的间隔创建刻度线:

It's pretty simple though, basically you will need to customize a Slider control to your liking, see this example from the Slider Class documentation on how to use the Ticks property to create tick marks along the Slider at irregular intervals:

<Slider Width="100" Value="50" Orientation="Horizontal" HorizontalAlignment="Left" IsSnapToTickEnabled="True" Maximum="3" TickPlacement="BottomRight" AutoToolTipPlacement="BottomRight" AutoToolTipPrecision="2" Ticks="0, 1.1, 2.5, 3"/>

更多推荐

WPF中缺少MediaElement标记

本文发布于:2023-07-11 11:57:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1093972.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:标记   WPF   MediaElement

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!