views:

38

answers:

3

Hi

I have an AJAX web service call that returns a chunk of HTML that I then apply to a DIV element on my page. This works fine for any html element except a flash video which comes up with 'Movie not loaded'.

I've double-checked the html that is being returned and it's all fine, and it works if I don't use AJAX, but when I use AJAX and then add it using JS it doesn't seem to attempt to load the playlist.

Any ideas? Thanks Kev

+1  A: 

If you use swfobject, you can dynamically insert flash into your html, which might fix your issue.

Jasper De Bruijn
The only issue with that is that I would then need to carry out this additional work on the client, and I wouldn't even know if there was a video required etc.
Mantorok
@Mantorok Jasper's suggestion is a good suggestion that would likely fix your problem. As my dad always says, use the right tool for the job. And you don't have the resources to use that tool, then perhaps you shouldn't be doing the job.
mattbasta
A: 

Perhaps the player SWF is to blame: it might be waiting for some kind of cue that the browser usually provides that you're not giving it with AJAX. Now there's no way to find that out, but try another player SWF, it might fire right up.

If that's not possible to do (a custom player, for instance), try using something like @Jasper suggested above (the added 1kb or so of overhead is negligible), but wrap all of your ajax in a JSON object and pass whether it's flash or not. Then you can do some logic to make it work that way.

mattbasta
A: 

I'm sorry to have wasted your time on this everyone, it turns out that there is actually an issue with some of the attributes in the HTML, and the reason I 'thought' it was OK was because it was running OK when I initially tested it and just assumed that the problems were because it was being added dynamically.

The issue was with the location of the SWF file, and the reason it wasn't being populated correctly is because the AJAX call resulted in the loading of the controls independently and certain properties weren't being initialised. It's all working fine now.

Mantorok