I am using the LibVLCSharp library to play an m3u8 file. (TS encrypted videos)
I want to use a string (text of the same file) instead of m3u8 file to the code for more security.
{In fact, I encrypt the m3u8 file with static key and save it on hard disk. I want to decrypt it in the program and play the m3u8 file without saving decrypted file on hard disk.}
Acceptable code for the library
LibVLC _libVLC = new LibVLC("");
_libVLC.SetLogFile("log1.txt");
videoView1.MediaPlayer = new MediaPlayer(_libVLC);
Media plist = new Media(_libVLC, "vi/file.m3u8", FromType.FromPath);
videoView1.MediaPlayer.Play(plist);
The code I want does not work
string s = "#EXTM3Urn
#EXT-X-VERSION:3rn
#EXT-X-TARGETDURATION:17rn
#EXT-X-MEDIA-SEQUENCE:0rn
#EXT-X-PLAYLIST-TYPE:VODrn
#EXT-X-KEY:METHOD=AES-128,URI="key",IV=0x00000000000000000000000000000000rn
#EXTINF:16.666667,rn
file0.tsrn
#EXTINF:8.333333,rn
file1.tsrn
#EXTINF:8.333333,rn
file2.tsrn
#EXTINF:9.133333,rn
file3.tsrn
#EXT-X-ENDLIST";
LibVLC _libVLC = new LibVLC("");
_libVLC.SetLogFile("log1.txt");
videoView1.MediaPlayer = new MediaPlayer(_libVLC);
byte[] byteArray = Encoding.UTF8.GetBytes(s);
Stream stream = new MemoryStream(byteArray);
MediaInput aa = new StreamMediaInput(stream);
Media plist = new Media(_libVLC, aa, "");
videoView1.MediaPlayer.Play(plist);
play m3u8 video with LibVLCSharp form a string.
hassan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.