开发者

How to convert byte array to uri

开发者 https://www.devze.com 2023-03-14 22:50 出处:网络
Have MediaElement in my application used to preview media file such as music, video, image.. MediaElement only allow set source is a URi(contain file path).

Have MediaElement in my application used to preview media file such as music, video, image.. MediaElement only allow set source is a URi(contain file path). I have image storaged by Byte array and now I want preview it on MediaElement. how to I convert from byte array to uri to preview mediafile ? If have any other solution to preview mediafie,开发者_如何学Go Please list it. Thank.!


if it is path...then you can use System.Text.Encoding.UTF8.GetString(byteArray[])

and then assign that path to media element to preview image...

If it is image, you have to convert back that image from byte and then assign it ti Image element...to preview. Check this link: http://www.codeproject.com/KB/recipes/ImageConverter.aspx


You can do it through a MemoryStream. See example here.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号