Windows Phone 7 - 使用 MediaElement 播放声音的特定部分

发布于 2024-12-26 00:28:43 字数 242 浏览 3 评论 0原文

我正在尝试使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甜是你 2025-01-02 00:28:43

您可以设置 标记。到达标记后,MarkerReached 事件被触发,您可以在那里停止声音 MediaElement

You can set Markers. Once a Marker is reached, the MarkerReached event is fired and you can stop the sound MediaElement there.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文