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

[Solved] Stop media playing when window closed

5 Answers 274 Views
Window
This is a migrated thread and some comments may be shown as answers.
Clive Hoggar
Top achievements
Rank 1
Clive Hoggar asked on 12 May 2009, 05:34 PM
Hi

I am wondering what is the 'right' way to fix this problem...

When the visitor use the X to close the RadWindow while the media is still playing,   different things happen
in IE and Firefox.

1 ) Firefox stops the sound, as desired
2 ) IE7 leaves it running, and it needs a page refresh to kill it.

How can I make IE do the same as firefox?

I did try destroy content on close (which works)  but that requires page refresh to be able to 
restart the video subsequently.

Also tried using onClientClose but could not get that to work.

Thanks for hints on this.

Clive

P.S The rad window is a very slick interface!

5 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 13 May 2009, 10:28 AM
Hi Clive,

In such scenario, you could use one of the following approaches:
  1. DestroyOnClose to true - as you noticed, in this case RadWindow's object is destroyed and you cannot open that same RadWindow again until the page is reloaded. When this property is set to true, I suggest to setup the RadWindow (size, position, etc) by using the client-side API every time you open the popup.
  2. Use the OnClientClose eventhandler to change the RadWindow's content page to some other URL, this will destroy the flash object too.


Best wishes,
Georgi Tunev
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
Clive Hoggar
Top achievements
Rank 1
answered on 13 May 2009, 09:22 PM
Hi

Can you give me an example of setting the NavigateUrl property to nothing or blank in
Javascript - if that is the way to do it?

Thanks

Clive
0
Shinu
Top achievements
Rank 2
answered on 14 May 2009, 05:58 AM
Hi Clive,

Try following client side code for setting the url in OnClientClose eventhandler of RadWindow.

JavaScript:
<script type="text/javascript"
function ShowWindow() 
    var oWnd = window.radopen('Dialog1.aspx''window1'); //Opens the window 
    oWnd.add_close(OnClientClose); //set a function to be called when RadWindow is closed 
}     
function OnClientClose(oWnd) 
  oWnd.setUrl("about:blank"); // Sets url to blank 
}     
</script> 

Thanks,
Shinu.
0
Clive Hoggar
Top achievements
Rank 1
answered on 14 May 2009, 08:34 PM
Hi
I have tried this but the window does not open now. This is the code :

<script type="text/javascript"
    function ShowWindow() { 
        //var oWnd = window.radopen('haut-brion-video.aspx', 'RaWindow2'); //Opens the window  
        oWnd.add_close(OnClientClose); //set a function to be called when RadWindow is closed  
    } 
    function OnClientClose(oWnd) { 
        oWnd.setUrl("about:blank"); // Sets url to blank  
    }      
</script>  
 
    <div id="divHautBrion"><asp:Image ID="ImageHautBrion" runat="server"  
        ImageUrl="~/images/screenshots/haut-brion.jpg" style="margin-top:4px;" /><br /> 
    <br />See the tasting assessment relating to the wines of Château Haut Brion and La Mission Haut Brion in this video     
     </div>  
    <telerik:RadWindow ID="RadWindow2" runat="server"  
        OpenerElementID="divHautBrion" Skin="Black" Animation="Fade"  
        BackColor="Black" KeepInScreenBounds="True" Modal="True"  
        NavigateUrl="~/buying-wine/haut-brion-video.aspx" Width="610px"  
        Height="440px" OnClientClose="OnClientClose()" OnClientShow="ShowWindow()"
    </telerik:RadWindow> 

I think maybe I have misundertood?

Thanks

Clive
0
Georgi Tunev
Telerik team
answered on 15 May 2009, 02:43 PM
Hello Clive,

Here is the correct code:
<script type="text/javascript">  
    function ShowWindow(oWnd) {  
        oWnd.add_close(OnClientClose); //set a function to be called when RadWindow is closed   
    }  
    function OnClientClose(oWnd) {  
        oWnd.setUrl("about:blank"); // Sets url to blank   
    }       
</script>   
  
    <div id="divHautBrion"><asp:Image ID="ImageHautBrion" runat="server"   
        ImageUrl="~/images/screenshots/haut-brion.jpg" style="margin-top:4px;" /><br />  
    <br />See the tasting assessment relating to the wines of Château Haut Brion and La Mission Haut Brion in this video      
     </div>   
    <telerik:RadWindow ID="RadWindow2" runat="server"   
        OpenerElementID="divHautBrion" Skin="Black" Animation="Fade"   
        BackColor="Black" KeepInScreenBounds="True" Modal="True"   
        NavigateUrl="~/buying-wine/haut-brion-video.aspx" Width="610px"   
        Height="440px"  
         
        OnClientClose="OnClientClose"  
        OnClientShow="ShowWindow" 
         
        >  
    </telerik:RadWindow>  



Kind regards,
Georgi Tunev
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.
Tags
Window
Asked by
Clive Hoggar
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Clive Hoggar
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or