WPF中缺少MediaElement标记 [英] MediaElement Markers Missing in WPF

查看:96
本文介绍了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?

谢谢您的帮助.

推荐答案

根据您的实际意图,您的问题有两个方面-请注意,

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:

这是

时间轴标记是与媒体文件中特定点关联的元数据.这些标记通常是提前创建的,并存储在媒体文件本身中.它们通常用于命名视频中的不同场景或提供脚本提示.通过处理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.)

假设这是您实际上要实现的目标,以及为什么偶然发现

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标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆