Windows Phone 7 - 使用 MediaElement 播放声音的特定部分
我正在尝试使用 MediaElement 播放 mp3 文件的特定部分。据我所知,我可以使用 Position 属性移动到声音中的特定时间并从那里开始播放。但我还想限制它播放的持续时间。例如,如果给定的 mp3 文件长 30 秒,我特别想播放第 5 秒到第 10 秒的声音,并希望播放停止。
我考虑过使用单独的后台线程或计时器回调来测量时间,然后唤醒以停止媒体元素。但我想知道 MediaElement 本身是否支持这样一种方式来指定播放时间的持续时间。
I'm trying to play a specific portion of a mp3 file using MediaElement. I understand that I can use the Position property to move to a specific time in the sound and start playing from there. But I would also like to restrict the duration when it plays. For example if a given mp3 file is 30 seconds long, i would specifically like to play the sound from 5th second to 10th second and want the playing to stop.
I thought about using a separate background thread or a timer callback that will measure the time and then wakeup to stop the mediaelement. But I was wondering if the MediaElement itself supports one such a way to specify the duration of the time to play.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以设置 标记。到达
标记
后,MarkerReached 事件被触发,您可以在那里停止声音MediaElement
。You can set Markers. Once a
Marker
is reached, the MarkerReached event is fired and you can stop the soundMediaElement
there.