Stop media playing when window closed

6 posts, 0 answers
  1. Clive Hoggar
    Clive Hoggar avatar
    348 posts
    Member since:
    Nov 2008

    Posted 12 May 2009 Link to this post

    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!

  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 13 May 2009 Link to this post

    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.
  3. Clive Hoggar
    Clive Hoggar avatar
    348 posts
    Member since:
    Nov 2008

    Posted 13 May 2009 Link to this post

    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
  4. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 14 May 2009 Link to this post

    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.
  5. Clive Hoggar
    Clive Hoggar avatar
    348 posts
    Member since:
    Nov 2008

    Posted 14 May 2009 Link to this post

    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
  6. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 15 May 2009 Link to this post

    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.
Back to Top