Reputation: 121
I am trying to embed videos using the Play Framework and JW Player. I can hard code and make it work just fine, but I want to use the model's class to determine the video file (via path) that will be embedded.
Here is the code I have been playing with, but is not working:
<script src="@{'/public/jwplayer/jwplayer.js'}"></script>
<script>
$(document).ready(function(){
var content = ${_post.content};
setVideo(content)
});
</script>
<script type='text/javascript'>
function setVideo( content )
{
jwplayer('mediaspace').setup({
'flashplayer': "@{'/public/jwplayer/player.swf'}",
'file': content,
'controlbar': 'bottom',
'width': '640',
'height': '480'
});
}
</script>
Honestly, this is probably more of pseudo code at this point... But hopefuly it is clear what I am trying to do here:
Any suggestions on how to tackle this?
Upvotes: 4
Views: 609
Reputation: 3742
Some ideas for tackling the issue:
var content
should be a string?_post.content
get generated? why the underscore? are you doing this from within a play template tag? Hope this helps.
Upvotes: 1