在媒体元素中播放网址

编程入门 行业动态 更新时间:2024-10-24 00:28:32
本文介绍了在媒体元素中播放网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何在wpf中的medial元素中播放url?

How to play a url in medial element in wpf?

推荐答案

目前无法将流分配为媒体元素。可能的解决方案将是.. stackoverflow/questions/7117589/使用-mediaelement-to-play-video-from-stream [ ^ ] stackoverflow/questions/7136213/playing-streaming-video-in-wpf [ ^ ] Assigning a Stream as media element is currently not possible.Possible solutions would be.. stackoverflow/questions/7117589/using-mediaelement-to-play-video-from-stream[^] stackoverflow/questions/7136213/playing-streaming-video-in-wpf[^]

private void MediaEL_MediaOpened(object sender, RoutedEventArgs e) 02 { 03 if (MediaEL.NaturalDuration.HasTimeSpan) 04 { 05 TimeSpan ts = MediaEL.NaturalDuration.TimeSpan; 06 seekBar.Maximum = ts.TotalSeconds; 07 seekBar.SmallChange = 1; 08 seekBar.LargeChange = Math.Min(10, ts.Seconds / 10); 09 } 10 timer.Start(); 11} 12

或者

or

public MainWindow() { BoxedAppSDK.NativeMethods.BoxedAppSDK_Init(); InitializeComponent(); } private void button2_Click(object sender, RoutedEventArgs e) { var MyFileStream = new CustomFileStream(File.ReadAllBytes(@"wildlife.wmv")); IntPtr ptr = BoxedAppSDK.NativeMethods.BoxedAppSDK_CreateVirtualFileBasedOnIStream( @"1.wmv", BoxedAppSDK.NativeMethods.EFileAccess.GenericWrite, BoxedAppSDK.NativeMethods.EFileShare.Read, IntPtr.Zero, BoxedAppSDK.NativeMethods.ECreationDisposition.New, BoxedAppSDK.NativeMethods.EFileAttributes.Normal, IntPtr.Zero, MyFileStream); using (new SafeFileHandle(ptr, true)) { mediaElement1.Source = new Uri(Path.GetFullPath("1.wmv")); mediaElement1.LoadedBehavior = MediaState.Manual; mediaElement1.Play(); } }

更多推荐

在媒体元素中播放网址

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

发布评论

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

>www.elefans.com

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