Function Video.js在暂停时运行显示iframe的函数

Function Video.js在暂停时运行显示iframe的函数,function,api,iframe,video.js,Function,Api,Iframe,Video.js,我正在阅读关于video.js api的文章,我想知道当视频暂停时,是否可以使用ready函数调用嵌入iframe的php页面? 谢谢 例: 编辑:多亏了海夫,我才得以工作。 代码如下: videojs("session_video").ready(function(){ var div = document.createElement('div'); div.innerHTML = '<iframe src="http://www.company.com/show.php"

我正在阅读关于video.js api的文章,我想知道当视频暂停时,是否可以使用ready函数调用嵌入iframe的php页面? 谢谢 例:

编辑:多亏了海夫,我才得以工作。 代码如下:

videojs("session_video").ready(function(){



var div = document.createElement('div');
  div.innerHTML = '<iframe src="http://www.company.com/show.php" width="300" height="250" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no" style="position:absolute;" left: 50%; margin-left:-WIDTHOFBANNER; top: 50%; margin-top:-HEIGHTOFBANNER;></iframe>';

  var ifrm = div.firstChild;

  this.on("pause", function(){
    this.el().appendChild(ifrm);
  });

  this.on("play", function(){
    this.el().removeChild(ifrm);
  });

});
videojs(“会话视频”).ready(函数(){
var div=document.createElement('div');
div.innerHTML='';
var ifrm=div.firstChild;
this.on(“暂停”,function(){
this.el().appendChild(ifrm);
});
this.on(“play”,function(){
this.el().removeChild(ifrm);
});
});

不确定dom操作,但这应该适用于Video.js API

videojs("session_video").ready(function(){

  var div = document.createElement('div');
  div.innerHTML = '<iframe src="http://www.company.com/show.php" width="300" height="250" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe>';

  var ifrm = div.firstChild;

  this.on("pause", function(){
    this.el().appendChild(ifrm);
  });

  this.on("play", function(){
    this.el().removeChild(ifrm);
  });

});
videojs(“会话视频”).ready(函数(){
var div=document.createElement('div');
div.innerHTML='';
var ifrm=div.firstChild;
this.on(“暂停”,function(){
this.el().appendChild(ifrm);
});
this.on(“play”,function(){
this.el().removeChild(ifrm);
});
});

PHP嵌入看起来像什么?代码的其余部分应该可以工作。您可以尝试
var ifrm=document.createElement('iframe');this.el().appendChild(ifrm)。如果你只是在那里嵌入HTML,它将不起作用。它需要添加javascript。我无法访问php文件。我从一个赞助商那里得到了代码,它看起来是这样的:
它显示一个300x250的横幅,就像一个图像广告。谢谢你的回答!代码运行良好,但我有两个问题。iframe显示在视频后面,无法单击。(可能来自“播放”参数)如果我单击横幅,视频将继续。谢谢,我删除了所有插件,只是为了确保不会干扰该功能。请尝试在iframe上添加style=“position:absolute;”。现在,横幅显示在视频中并可单击。最后一个问题:我如何改变它的位置。这是一个带有当前位置的SS:是否可以放置在中间?添加到样式属性“左:50%;余量左边:- WIDTHOFBANNER;顶部:50%;空白顶部:- HEIGHTOFBANNER;”替换所描述的单词中的单词,并保持前面的否定符号。(如果答案对你有效,请不要忘记接受。)
videojs("session_video").ready(function(){

  var div = document.createElement('div');
  div.innerHTML = '<iframe src="http://www.company.com/show.php" width="300" height="250" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe>';

  var ifrm = div.firstChild;

  this.on("pause", function(){
    this.el().appendChild(ifrm);
  });

  this.on("play", function(){
    this.el().removeChild(ifrm);
  });

});