I am trying to embed a video using Play Framework and JW Player. I can hard code and do it very well, but I want to use the model class to define the video file (via the path) that will be embedded.
Here is the code that I played with but doesn't work:
<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 pseudo-code at the moment ... But hopefully it is clear what I am trying to do here:
- Get the content of the message (in case the content is the path to the video)
- Put this in a function.
- Which will install the contents of the "file" :.
Any suggestions on how to handle this?
source share