Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Forums

/

JW WMV Player requires $(document).ready function

4 replies [Last post]

I've been working through the setup pages for the WMV player and couldn't get it to work despite using the setup builder and checking all the code -- I'm using FF3 but it failed in Safari too.

Using this code does not work

                <script type="text/javascript" src="js/silverlight.js"></script>
<script type="text/javascript"  src="js/wmvplayer.js"></script>
<script type="text/javascript">
//$(document).ready(function()
//{  
var cnt = document.getElementById("mediaspace");
var src = './js/wmvplayer.xaml';
var cfg = {
overstretch:'true',
lightcolor:'f85010',
file:'./movies/cse_draft_0001.wmv',
screencolor:'ffffff',
width:'480',
height:'320',
backgroundcolor:'ffffff'
};
var ply = new jeroenwijering.Player(cnt,src,cfg);
//});
</script>

Using this code works

<script type="text/javascript" src="js/silverlight.js"></script>
<script type="text/javascript"  src="js/wmvplayer.js"></script>
<script type="text/javascript">
$(document).ready(function()
{  
var cnt = document.getElementById("mediaspace");
var src = './js/wmvplayer.xaml';
var cfg = {
overstretch:'true',
lightcolor:'f85010',
file:'./movies/cse_draft_0001.wmv',
screencolor:'ffffff',
width:'480',
height:'320',
backgroundcolor:'ffffff'
};
var ply = new jeroenwijering.Player(cnt,src,cfg);
});
</script>

Whoops, I meant to add in that if $(document).ready(function()....) is required then shouldn't it be in the manual?

I've used the JW Flash Player on another site and I did not require the use of $(document).ready()...

Nevermind, I just figured this out.

The container cnt needs to be defined before the script is run unless you're using $(document).ready() - so I moved by container above the code that didn't work and voila.

The $(document).ready would require jQuery. I tried it with jQuery and my 15 MB WMV video still didn't load. The wmvplayer javascript does work, however my video doesn't load. Hmmm ...

I cannot get it to work at all. I even dumped the download into a directory called JS and launched the readme.html file. The player still does not load.