locked
play video from buffer RRS feed

  • Question

  • HELLO,
     
    I'm at a project with playing encryted video playing, i'll try to
    explian to you basiclly my purpose,
     
    1.Stage = Im Cryting all my video files with my special algorithm,
    2.Stage = User Decrytes his videos with his own password,
    3.Stage = My algorithm Decrytes the binary video file and writes into a
    memorystream
     
    The problem starts at 3.stage, i dont want to write my stream into a
    file, i need to play that video file from the buffer (from memory), do you know any ways
    to do that
    Tuesday, May 1, 2012 12:04 PM

Answers

  • Hi ilkerxx,

    Like u said in ur post above if u can convert ur video into any format then u can make use of WPF MediaElement control.

    MediaElement control will right away play all the file types supported by Windows Media Player eg: .avi etc....

    MediaElement also gives u functionality of stopping, pausing and resuming the video.

    Use of directX will aslo help u but its too complex and since converting ur video into any format isn't a problem for u so use of MediaElement is a better option.

    Hope it helps!


    Regards, Parth Shah


    • Edited by parth.shah Tuesday, May 1, 2012 12:36 PM
    • Marked as answer by Annabella Luo Tuesday, May 15, 2012 6:56 AM
    Tuesday, May 1, 2012 12:35 PM

All replies

  • Hi ilkerxx,

    Please see the code snippet below for ur query.

    CodeBehind:
    
    byte[] videoFrame = new byte[1024];
                    BitmapImage bitmap = new BitmapImage();
                    bitmap.StreamSource = new MemoryStream(videoFrame);
                    System.Windows.Controls.Image img = new System.Windows.Controls.Image();
                    img.Source = bitmap;

    Here in the above code snippet videoFrame consists of frames of ur decrypted video file.

    Here we consider that u have decrypted ur video file into YUV format. If ur video file is in some other container format u might have to use specific decoders as well.

    Hope it helps!


    Regards, Parth Shah

    Tuesday, May 1, 2012 12:22 PM
  • parth.shah, thanks for your answer

    I can convert my file in any files.However, i understand that i can show my video only with picturebox but i need to forward the video pause or play to.

    I made some research in one weeks and i saw that there are some activex with price of course.. They can play their video problemless with loading video from bytearray...

    I made some research about directshow to. I heard that i can solve this problem with GSSF filters, but actually i dont what filters is :)
    is there some better solutions about playing my video like real one.

    Thank you
    Tuesday, May 1, 2012 12:31 PM
  • Hi ilkerxx,

    Like u said in ur post above if u can convert ur video into any format then u can make use of WPF MediaElement control.

    MediaElement control will right away play all the file types supported by Windows Media Player eg: .avi etc....

    MediaElement also gives u functionality of stopping, pausing and resuming the video.

    Use of directX will aslo help u but its too complex and since converting ur video into any format isn't a problem for u so use of MediaElement is a better option.

    Hope it helps!


    Regards, Parth Shah


    • Edited by parth.shah Tuesday, May 1, 2012 12:36 PM
    • Marked as answer by Annabella Luo Tuesday, May 15, 2012 6:56 AM
    Tuesday, May 1, 2012 12:35 PM
  • MediaElement sounds great of course but i dont think that i can load my video file from a memorystream, thats the point actually i dont have a file with video, i got a memorystream which contains bytes of a decryted movie

    Thanks
    Tuesday, May 1, 2012 12:39 PM
  • Hi ilkerxx,

    Currently there is no native way to show video from a memory stream. As far as I know, if we want to display the byte[] type video use MediaElement, we need first to convert the byte[] to steam.

    Hope it helps.

    Have a nice day.


    Annabella Luo[MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, May 8, 2012 10:00 AM
  • We are temporarily marking this as "Answer", if you have any concerns or new findings; please feel free to let me know.
    Best regards.

    Annabella Luo[MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, May 15, 2012 6:56 AM