This is a migrated thread and some comments may be shown as answers.

Media Player stops when switch panes in DocumentHost

4 Answers 40 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Kashif Imran
Top achievements
Rank 1
Kashif Imran asked on 04 May 2009, 09:36 PM

I have two panes in DocumentHost. Second pane has MediaPlayer in it. While video is being played, if I click on first pane, video stops. When I go back to the pane that has mediaplayer, video does not start playing. I have to refresh page to load silverlight app to get media player to start working again. Below is my xaml. 

<

 

telerikDocking:RadDocking x:Name="docking" Grid.Row="2" Grid.Column="0" BorderThickness="0" >

 

 

 

<telerikDocking:RadDocking.DocumentHost>

 

 

 

<telerikDocking:RadSplitContainer>

 

 

 

<telerikDocking:RadPaneGroup>

 

 

 

<telerikDocking:RadPane x:Name="paneStartPage" telerikDocking:RadDocking.SerializationTag="paneStartPage" Header="Start Page">

 

 

 

<!--Start Page-->

 

 

 

<nile:StartPage x:Name="startPage"></nile:StartPage>

 

 

 

</telerikDocking:RadPane>

 

 

 

<telerikDocking:RadPane x:Name="paneCEViewer" telerikDocking:RadDocking.SerializationTag="paneCEViewer" Header="Course Element Viewer" CanFloat="False">

 

 

 

<!--Course Element Viewer Area-->

 

 

 

<nile:CourseElementViewer x:Name="ceViewer"></nile:CourseElementViewer>

 

 

 

</telerikDocking:RadPane>

 

 

 

</telerikDocking:RadPaneGroup>

 

 

 

</telerikDocking:RadSplitContainer>

 

 

 

</telerikDocking:RadDocking.DocumentHost>

 

4 Answers, 1 is accepted

Sort by
0
Accepted
Miroslav
Telerik team
answered on 06 May 2009, 01:58 PM
Hi Kashif Imran,

Unfortunately this is a limitation of Silverlight. A MediaElement that is not in the visual tree (like when you switch to a different tab) cannot be visible or audible.

This also happens when you want to switch to fullscreen.

Unfortunately the video cannot be running while it is invisible.

What you can do though is remember the position of the current media item whenever the user navigates away from the player and restore it when the user switches to the same RadPane again.

In this example you can see how the current media item position is restored after a fullscreen change:

http://demos.telerik.com/silverlight/#MediaPlayer/Fullscreen

All the best,
Miroslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Kashif Imran
Top achievements
Rank 1
answered on 06 May 2009, 02:33 PM
Miroslav,

What you said make sense, but video freezes up even when the player is visible and I only rearrange some panes outside the document host (media player is inside document host). As you can see in my xaml I have documents host and then a RadGroup below it. Even when I arrange some panes in that group, video freezes up and I have to refresh the page to make it work again.

<

 

telerikDocking:RadDocking x:Name="docking" Grid.Row="3" Grid.Column="0" BorderThickness="0" >

 

 

 

<telerikDocking:RadDocking.DocumentHost>

 

<telerikDocking:RadSplitContainer>

<telerikDocking:RadPaneGroup>

<telerikDocking:RadPane x:Name="paneCEViewer" telerikDocking:RadDocking.SerializationTag="paneCEViewer" Header="" Title="" CanFloat="False">

 

</telerikDocking:RadPane>

</telerikDocking:RadPaneGroup>

</telerikDocking:RadSplitContainer>

</telerikDocking:RadDocking.DocumentHost>

 

 

<telerikDocking:RadSplitContainer InitialPosition="DockedBottom">

 

 

 

<telerikDocking:RadPaneGroup AllTabsEqualHeight="False">

 

 

 

<telerikDocking:RadPane x:Name="paneCourseContent" CanDockInDocumentHost="False" telerikDocking:RadDocking.SerializationTag="paneCourseContent" Header="Course Content" Title="Course Content">

 

 

 

<!--Course Content Outline-->

 

 

 

<nile:CourseContent x:Name="courseContent"></nile:CourseContent>

 

 

 

</telerikDocking:RadPane>

 

 

 

<telerikDocking:RadPane x:Name="paneNotes" CanDockInDocumentHost="False" telerikDocking:RadDocking.SerializationTag="paneNotes" Header="Notes" Title="Notes">

 

 

 

<!--My Notes-->

 

 

 

<nile:NotesViewer x:Name="notes"></nile:NotesViewer>

 

 

 

</telerikDocking:RadPane>

 

 

 

<telerikDocking:RadPane x:Name="paneAskMentor" CanDockInDocumentHost="False" telerikDocking:RadDocking.SerializationTag="paneAskMentor" Header="Ask Mentor" Title="Ask Mentor">

 

 

 

<!--Ask Mentor-->

 

 

 

<nile:AskMentor x:Name="askMentor"></nile:AskMentor>

 

 

 

</telerikDocking:RadPane>

 

 

 

</telerikDocking:RadPaneGroup>

 

 

 

</telerikDocking:RadSplitContainer>

 

</telerikDocking:RadDocking>

 

0
Accepted
Miroslav Nedyalkov
Telerik team
answered on 08 May 2009, 11:16 AM
Hi Kashif Imran,

The problem is that the Docking control pulls the panes, groups and split containers from the VisualTree when you are dragging some pane or group, to optimize the count of the automatically generated split containers. I created a workaround that overcomes that limitation of Silverlight when the media player is in the Docking control. Actually it works always, but when you know when the MediaPlayer control will be detached from the VisualTree it is better to do it in a different way. A sample project is attached to this post.

What is the idea - I created a DispatcherTimer that makes ticks every second and saves the position. When the media is re-opened (this happens when it is detached from the VisualTree and attached again), I moved the progress to the position that was saved last time. One more thing - if the progress is less than the Interval of the timer, I did not save the progress - that means that the MediaPlayer control was just detaches (and re-attached).

Let me know if this works for you as you expect.

All the best,
Miroslav Nedyalkov
the Telerik team

Instantly find answers to your questions on the newTelerik Support Portal.
Check out the tipsfor optimizing your support resource searches.
0
Kashif Imran
Top achievements
Rank 1
answered on 08 May 2009, 12:58 PM
Thanks. I will try the workaround and let you know if have any problems with that.
Tags
Docking
Asked by
Kashif Imran
Top achievements
Rank 1
Answers by
Miroslav
Telerik team
Kashif Imran
Top achievements
Rank 1
Miroslav Nedyalkov
Telerik team
Share this question
or