Tech Off Thread

10 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Video recording/playing wpf

Back to Forum: Tech Off
  • User profile image
    kaul

    What is the most optimal (in terms of resources and performance) way of recording and playing video file in wpf (windows) application? While I am still guessing how to record, I tried playing video using MediaElement, the problem is that it shows black screen initially (first time only) for few seconds. How to avoid that ?   

  • User profile image
    footballism

       WPF doesn't support video recording, as to the video playback, does the video file reside on the remote location or it just sits in the local file system, how large is it?

    Sheva

  • User profile image
    kaul

     The video file resides locally and is around 5 MB in size. The black screen appears only for the first time, caching - can that be a culprit ? I am allocating the source dynamically and the xaml for the control looks like -

    <MediaElement Name="medeleVideo" Height="415" Width="552" LoadedBehavior="Manual" Margin="-310,72,0,0" HorizontalAlignment="Right" VerticalAlignment="Bottom" Visibility="Collapsed"/>

  • User profile image
    footballism

       Huh, Have you ever tried your WPF app on other PCs which have different GPU specs, AFAIK, MediaElement will behave quite differently on some GPUs.

    Sheva

  • User profile image
    kaul

    Ok, I tested the application on different machines, updated drivers and all other tricks that I found on different blogs.... nothing seems to be working for me Sad . after spending half of my day I have found that the problem of black screen arises when I try to use the mediaelement for playing different video files i.e. when I try to assign source dynamically. The application works fine if I play single video.I tried different UnloadedBehaviors but to no avail. Using MediaElement.Stop() to stop the video.

  • User profile image
    kaul

    With little more research on the matter I found that the problem is with setting the source of a mediaelement when it already has one. What is the exact way to reassign the source of mediaelement I mean should I set it to "null" before reassigning, should I use MediaElement.Close() ?

  • User profile image
    footballism

       I haven't test it, but I think the behaviour you see is really reasonable, since in order to play back videos more efficiently, WPF will actually load the video file into video memory, I reckon this process takes time.

    Sheva

  • User profile image
    kaul

    Can MediaPlayer be helpful in such a scenario ? Expressionless

  • User profile image
    sinclas

    Hi,

    I am trying to load video dynamically also.  I noticed that while setting the source, the video went black for a period of 10 seconds prior to playing. Some files are only 2 megs while others are 20.  I am replacing a Flash application with a WPF application and can't get the user experience to match since the video takes too long to load.  Is there a streaming property to get this video to play faster?

    Thanks,
    Steve

  • User profile image
    kaul

    What kind of application, you are working on - Windows or Web ? Buffering can help you put, if its web application. 

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.