Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1030
Media element in dock panel
posted

Hi,

We are using xamDockManager in our application to show certain areas that can be hidden. In this we have a dockpanel that contains XamGrid. On addition of any row in xamgrid we start media using mediaelement, which is added in Grid layout panel. Now the issue is when media is playing and we pin or unpin the dockpanel media stops immediately and if we keep it as it is then media is playing perfectly. So can any one please help me put here.

Thanks

Chris

Parents
No Data
Reply
  • 34510
    Verified Answer
    Offline posted

    Hi Chris,

    I assume your MediaElement has it's AutoPlay property set to False correct?  The reason the media stops playing is because when you pin/unpin a pane in the XamDockManager it rebuilds the visual tree for the pane's content so this effectively recreates a new MediaElement.  If AutoPlay is set to false then the video will appear to stop playing.  Even if you set AutoPlay to true you're going to end up with a video that resets back to 0 when you pin/unpin.

    To resolve this you need to keep track of when the video is playing and its current play position so that when the MediaElement is recreated you can play and set the correct position.  This way the video continues playing from where it left off.  I've attached a sample that demonstrates a basic way you can implement this.  When you run the sample you need to add a row to the XamGrid in order to start the MediaElement.  Then you can pin/unpin the pane and see how the video continues where it left off.

    You will need to add an appropriate WMV to the sample as I was unable to attach the video I used here.  The file is too large.

    Let me know if you have any questions on it.

    xamDockManager-MediaElement.zip
Children
No Data