0
這是我的代碼。我想在JWplayer中顯示自定義錯誤消息。目前我正在顯示圖像。如何在JWplayer中爲不同情況實現自定義錯誤消息。我想爲不同的參數顯示錯誤信息。無法在jwplayer中添加錯誤消息的自定義消息
var videoNode = document.getElementById("videoUrlPath").value;
var player = jwplayer('play');
var playerCall = true;
var seeking = false;
var currentPosition = 0;
var jw_selector = "#play";
player.setup({
file: videoNode,
width: "100%",
aspectratio: "16:9",
autostart: true,
/*advertising: {
client: 'vast',
schedule: {
adbreak1: {
offset: "pre",
tag: '/static/assets/vast.xml',
'skipoffset': '5'
}
}
},
"sharing": {
"sites": ['facebook', 'twitter', 'email'],
link: ''
},*/
skin: {
name: 'myskin',
url: 'assets/theme/js/jwplayer-7.8.6/skins/tfcskin.css'
},
});
player.play();
player.onSetupError(function (error) {
player.setup({
file: "http://content.jwplatform.com/videos/7RtXk3vl-52qL9xLP.mp4",
width: "100%",
aspectratio: "16:9",
image: "assets/theme/images/error-video.jpg"
});
player.play();
});
player.onTime(function (callback) {
currentPosition = callback.position;
if (this.getPosition() === this.getDuration() && playerCall) {
playerCall = false;
document.getElementById("viewcountincrease").click();
}
})
player.onPlay(function (event) {
playerCall = true;
})
player.onSeek(function() {
if (!seeking) {
seeking = true;
var _currentPosition = currentPosition;
/* WITH A SMALL DELAY SCROLL BACK */
window.setTimeout(function() {
var elem = document.querySelector(jw_selector);
jwplayer(elem).seek(_currentPosition);
}, 100);
} else seeking = false;
});