我将JW Player版本5嵌入到网页中。我只将它用于AUDIO。在浏览器和Android设备上一切正常。但是,在使用Safari浏览iPad时,音频将无法播放。它被设置为使用户必须单击播放按钮才能开始播放文件。当您单击按钮时,它会显示“下载不可用”之类的内容。我无法提供内部开发服务器上的链接,但这是我正在使用的代码(如果它有帮助)。任何建议都将不胜感激。
var secondsPlayed, myDuration, pctViewed, isComplete, lastTimeStamp;
window.onload = function ()
{
myDuration = <%=intTotalLength %>;
isComplete = false
lastTimeStamp = 0
jwplayer("container").setup({
flashplayer: "js/jwplayer/player.swf",
file: "<%=strAudioFileName%>",
controlbar: "bottom",
height: 20,
width: 350,
Duration:<%=intTotalLength %>,
events: {
onTime: function (event) {
secondsPlayed = event.position;
pctViewed = secondsPlayed / myDuration * 100;
if (pctViewed > 99.99) {
isComplete = true;
}
},
onMeta: function (evt) {
if ((typeof evt.metadata.duration != "undefined") && (evt.metadata.duration > 0)) {
myDuration = evt.metadata.duration;
}
},
onPlay: function () {
startTracking();
},
onComplete: function () {
stopTracking()
}
}
});
}
function startTracking() {
setTimeout("updateViewData()", 20000);
}
function stopTracking() {
isComplete = true;
updateViewData();
}
function updateViewData() {
if (secondsPlayed != lastTimeStamp) {
lastTimeStamp = secondsPlayed;
$.ajax({
url: "mediatimetracker.asp",
type: "post",
data: "ViewId=<%=strViewID %>&SecondsPlayed=" + secondsPlayed + "&IsComplete=" + isComplete,
success: function (res) {
if (isComplete == false) setTimeout("updateViewData()", 20000);
}
});
}
}