Jonathan DInh
Jonathan DInh

Reputation: 31

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?

Upvotes: 1

Views: 185

Answers (1)

Jonathan Gray
Jonathan Gray

Reputation: 2609

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

Upvotes: 1

Related Questions