Javascript 如果Jwplayer加载媒体时出错,则重定向到url

Javascript 如果Jwplayer加载媒体时出错,则重定向到url,javascript,php,redirect,jwplayer,Javascript,Php,Redirect,Jwplayer,我在我的页面上嵌入了JWPlayer,但有时视频无法加载,如果JWPlayer无法加载文件,有人可以帮助我如何重定向到新的url 这是我的代码: <script type='text/javascript'> jwplayer('player').setup({ file: 'http://blog.com/stream.m3u8', image: 'http://blog.com/streamimage.png', title

我在我的页面上嵌入了JWPlayer,但有时视频无法加载,如果JWPlayer无法加载文件,有人可以帮助我如何重定向到新的url

这是我的代码:

<script type='text/javascript'>
    jwplayer('player').setup({
        file: 'http://blog.com/stream.m3u8',
        image: 'http://blog.com/streamimage.png',
        title: 'STREAMING TITLE',
        width: '100%',
        height: "100%",
        aspectratio: '16:9',
        skin: 'glow',
        mute: 'true',
        ga: '{}'
    });
</script>
像这样:

 <?php header("Location: http://www.example.com/"); ?> /* Redirect browser */
/*重定向浏览器*/

请帮助我使用javascript重定向,您可以使用:

window.location.href = 'http://wherever';
window.location.href = 'http://wherever';