3

How to convert base64 video in Windows Phone,

I have base64 string :

string str = "aqtuphnzx+rnmhjqipo";

How do I convert?

Thanx!!

Binjal Shah
  • 311
  • 1
  • 9

1 Answers1

2

You could use the Convert utility class to Convert.FromBase64String() your input to get the raw bytes. You'll probably want to wrap this byte array in a memory stream while you're at it.

var str = "aqtuphnzx+rnmhjqipo";
var videoStream = new MemoryStream(Convert.FromBase64String(str));

Note that your sample str is not actually a base64-encoded string as far as I can tell.

Steven Liekens
  • 13,266
  • 8
  • 59
  • 85
  • steven,thank you so much..can you help me little more??How do I set source of Media element of that stream??I have to play video using media element.Thanx – Binjal Shah Jun 06 '14 at 06:50
  • 1
    Don't think you can use `MediaElement` for streams. See: http://stackoverflow.com/questions/7117589/using-mediaelement-to-play-video-from-stream – Steven Liekens Jun 06 '14 at 06:55
  • thank you steven, can you suggest me a good method, Is IsolatedStorage is useful here? – Binjal Shah Jun 06 '14 at 07:00
  • I've never programmed for WP before, so I'm not familiar with IsolatedStorage files. However, any way to make your video accessible through a URI (that includes file paths) will suffice. Can you save the video to IsolatedStorage and then get its file path? – Steven Liekens Jun 06 '14 at 07:04
  • steven, I am saving video in isolated storage, but next what to do that I do not know?thank you – Binjal Shah Jun 06 '14 at 07:06