What happens when we create setTimeout or Ajax call?
I have a problem with invoking autoplay in HTML5 player on iPad.
If I call thing like that:
[CODE]
function playItem()
{
var playerArea = $('#playerArea');
var flowplayerAjdi = getFlowplayerId();
playerArea.empty();
playerArea.append(createQualityChooserHTML()+'<div><a id="'+flowplayerAjdi+'" class="'+flowplayerAjdi+'"></a></div><div id="hulu" class="hulu"></div>');
clipProperties.url = 'http://192.168.100.107:1935/ia/live/playlist.m3u8';
playLiveFlowplayer(flowplayerAjdi, getWowzaUrl('ia'), '', '', true, true);
}[CODE]
everything works fine. But you can see that url is hardcoded - it has to be assigned by ajax call. So here is what I did:
[CODE] function playItem()
{
$.ajax({
url : 'playVODServlet',
type : 'GET',
data : JSON.stringify(playItemParams),
timeout : 5000,
dataType : "json",
error : function(xhr, ajaxOptions, thrownError)
{
console.error("Error");
},
success : function(searchResult)
{
var playerArea = $('#playerArea');
var flowplayerAjdi = getFlowplayerId();
playerArea.empty();
playerArea.append(createQualityChooserHTML()+'<div><a id="'+flowplayerAjdi+'" class="'+flowplayerAjdi+'"></a></div><div id="hulu" class="hulu"></div>');
clipProperties.url = searchResult.assetId;
playLiveFlowplayer(flowplayerAjdi, getWowzaUrl('ia'), '', '', true, true);
}
});
}[CODE]
An now autostart doesn't work.
So my question is: what could be the problem? It looks it is related with ajax call breaks normally code execution and creates error and success function. Same thing happens if I put player constructor to setTimeout.
best