我正在jwplayer中使用自定义广告,但它对我不起作用,这是我的代码,
(1) customad.php
<html>
<head>
<script type="text/javascript" src='http://content.jwplatform.com/libraries/DkwOvSfA.js'></script>
</head>
<body>
<div id="container">Loading the player...</div>
<script>
var playerInstance = jwplayer('container');
playerInstance.setup({
file: 'https://testvideoout.s3.amazonaws.com/Videos/Streaming/mp4_Videos_29_1446555606635',
image: "https://testvideoout.s3.amazonaws.com/Videos/Thumb/Thumb_Videos_29_1446555606635_00001.png",
primary: 'flash',
type: "mp4",
advertising: {
client: 'vast',
tag: 'advertise.xml',
}
});
</script>
</body>
</html>
(2) advertise.xml
<VAST xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0" xsi:noNamespaceSchemaLocation="vast3_draft.xsd">
<Ad id="midroll-1" sequence="1">
<InLine>
<AdSystem version="2.0">JW Player</AdSystem>
<AdTitle>Static Tag</AdTitle>
<Error>
http://demo.jwplayer.com/static-tag/pixel.gif?err=[ERRORCODE]
</Error>
<Impression>http://demo.jwplayer.com/static-tag/pixel.gif</Impression>
<Creatives>
<Creative sequence="1">
<Linear skipoffset="00:00:03">
<Duration>00:00:30</Duration>
<TrackingEvents>
<Tracking event="start">http://demo.jwplayer.com/static-tag/pixel.gif</Tracking>
<Tracking event="firstQuartile">http://demo.jwplayer.com/static-tag/pixel.gif</Tracking>
<Tracking event="midpoint">http://demo.jwplayer.com/static-tag/pixel.gif</Tracking>
<Tracking event="thirdQuartile">http://demo.jwplayer.com/static-tag/pixel.gif</Tracking>
<Tracking event="complete">http://demo.jwplayer.com/static-tag/pixel.gif</Tracking>
<Tracking event="pause">http://demo.jwplayer.com/static-tag/pixel.gif</Tracking>
<Tracking event="mute">http://demo.jwplayer.com/static-tag/pixel.gif</Tracking>
<Tracking event="fullscreen">http://demo.jwplayer.com/static-tag/pixel.gif</Tracking>
</TrackingEvents>
<VideoClicks>
<ClickThrough>http://www.jwplayer.com</ClickThrough>
<ClickTracking>http://demo.jwplayer.com/static-tag/pixel.gif</ClickTracking>
</VideoClicks>
<MediaFiles>
<MediaFile id="1" delivery="progressive" type="video/mp4" bitrate="400" width="640" height="360">
http://demo.jwplayer.com/static-tag/jwplayer-30s.mp4
</MediaFile>
</MediaFiles>
</Linear>
</Creative>
<Creative>
<CompanionAds>
<Companion id="1" width="300" height="250">
<StaticResource creativeType="image/jpg">
http://demo.jwplayer.com/static-tag/jwplayer-rectangle.jpg
</StaticResource>
<CompanionClickThrough>http://www.jwplayer.com</CompanionClickThrough>
</Companion>
<Companion id="2" width="728" height="90">
<StaticResource creativeType="image/jpg">
http://demo.jwplayer.com/static-tag/jwplayer-leaderboard.jpg
</StaticResource>
<CompanionClickThrough>http://www.jwplayer.com</CompanionClickThrough>
</Companion>
</CompanionAds>
</Creative>
</Creatives>
</InLine>
</Ad>
</VAST>
有人能看看它,告诉我里面出了什么问题吗?我试了很多,但对我不起作用。
我将您的代码复制/粘贴到文件advertise.htm和advertise.xml中,并将它们放在测试服务器上的同一位置,没有发现任何问题。
请确保您正在远程工作,而不是在本地系统上编辑它们的文件。您可能会遇到协议问题:
得到file://ssl.p.jwpcdn.com/player/v/7.2.3/jwplayer.flash.swfnet::ERR_FILE_NOT_FOUND
XMLHttpRequest无法加载file:///Users/user/Desktop/so.xml.跨源请求仅支持以下协议方案:http、data、chrome、chrome扩展、https、chrome资源扩展。
如果这没有帮助,请编辑您的问题并提供更多信息。添加更好的描述,以及控制台中看起来有趣的任何信息。