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.
精彩评论