我尝试在VibeJS(基于VideoJS的播放器)中使用VAST插播视频广告。我收到一个奇怪的问题和错误消息:
```Uncaught SyntaxError: Unexpected token var```
```error parsererror```
问题:广告会播放,但仅适用于已登录的用户。然后我也收到此消息:
```video.js:1 VIDEOJS: ERROR: TypeError: Cannot read property 'currentResolution' of null
at constructor.s.update (vibe.plugins.js:4)
at e.n (video.js:2)
at HTMLDivElement.n (video.js:2)
at HTMLDivElement.X.n.dispatcher.n.dispatcher (video.js:1)
at K (video.js:1)
at e.trigger (video.js:2)
at e.o.updateSrc (vibe.plugins.js:4)
at e.<anonymous> (vibe.plugins.js:4)
at n (video.js:2)```
For guests, the player loads without ads and only in low quality without enhanced controls. This is really weird.
I tried to modify and remove code from the ads section. Also I rewrote the players files multiple times. I'm using the newest version of my video CMS.
错误消息,请参见上文。我希望VAST广告可以在所有普通播放器中正常播放。
我可以提供完整的播放器和播放器实现文件,在此处附加代码是行不通的,因为它太多了。
在这里放置VAST标签:
Uncaught SyntaxError: Unexpected token var
播放时:
Uncaught (in promise) DOMException
播放器实现:
{
global $video;
/* Render VideoJs Player */
$ads = _vjsads();
$embed = '<video id="tvideo" class="video-js vjs-default-skin vjs-big-play-centered" controls preload="auto" poster="' . $thumb . '" data-setup=\'{"controls": true, "autoplay": false, "fluid": true, "aspectRatio": "16:9", "errorDisplay": false, "resizeManager": false, "muted": false, "playbackRates": [0.5, 1, 1.5, 2]}\'>';
if(!empty($extra)) {
/* Unset sd/hd */
if(isset($extra['sd'])) {unset($extra['sd']);}
if(isset($extra['hd'])) {unset($extra['hd']);}
foreach ($extra as $size=>$link) {
$embed .= '<source src="' . $link . '" type=\'video/mp4\' label =\''._lang(str_replace('hd','',$size).'p').'\' res=\''.$size.'\'/>';```