Search code examples
javascriptjwplayerjwplayer6

JwPlayer - Using javascript generated URL as file location


I have a javascript that generate the URL of the file I want to stream. i.e

var myURL;
//javascript codes here
document.write(myURL); //will output something like this - http://domain.com/file.mp4

And I want to use that as my file. I tried doing this but it does not work.

<script type='text/javascript'>
jwplayer('player1').setup({
file: 'document.write(newURL);',    
width: '640',
height: '360'
});
</script>

Is this possible? If so what should be the correct approach on doing this?


Solution

  • <script type='text/javascript'>
    jwplayer('player1').setup({
    file: newURL,  
    width: '640',
    height: '360'
    });
    </script>