Unable to open kWidget in ajax call/pop up

I have an application which calls the Kaltura library like so where xxx and zzz represent our partnerid and uiconfi_id:

<script src="https://www.kaltura.com/p/xxx/sp/xxx00/embedIframeJs/uiconf_id/zzz/partner_id/xxx"></script>

I make a call to my controller to return an html snippet as below via an Ajax Post:

<h2 class="title">@Model.Title</h2>
<div id="video-window" itemprop="video" itemscope itemtype="https://schema.org/VideoObject"></div>

The ajax post is:

$('a[class="video"][data-cid]').on('click', function (e) {
e.preventDefault();
var mydata = $(this).data();

setSize(false);

$.post('/My/GetMediaPlayer', { 'title': mydata.title }, function (data) {
$('#player-window-large').html(data).find("#video-window").css({ "width": width, "height": height });

$('#popup2').modal();

kWidget.embed({
"targetId": "video-window",
"wid": "_xxx",
"uiconf_id": "zzz",
"flashvars": {},
"entry_id": "1_abcde"
});  
});

The popup works, the screen is resized but the kWidget does not appear. I have tried a number of times to try and load Kaltura dynamically but the API docs are not very helpful. Can someone explain what is wrong with this?

Hi David,
Please check our modal player example page: http://player.kaltura.com/modules/KalturaSupport/tests/BootstrapModal.html

Hi Amir,

Thank you for the response. However this still does not work where a modal is called via an Ajax request. I have updated my script to run with the code suggested but this still does not display a player. It is almost as if the kWidget.embed does not re-load the DOM for new objects created by Ajax to which this player will reside.

Can you supply a test page demonstrating the issue?

Hi Amir,

I have built a cut down version of my App and put it here for you to download.

Thanks David but I don’t work with C# nor do I have visual studio. If you have a simple test page demonstrating the issue - please send me the link.
Amir

Hi Amir,

I don’t think I can give you a simple test page without scripting something completely different to what I am working with.

If you want you could just run it under VS Express to see the end result. You can get VS Express Web free here https://www.visualstudio.com/en-US/products/visual-studio-express-vs if you fancy giving it a go.

Sorry David but I won’t be able to do that.
If you need commercial support, you can go with our OnPrem solution.

Ok I’ll try that, thanks anyway