videojs:播放后更改标题属性

时间:2018-01-29 13:13:12

标签: jquery attributes html5-video title video.js

我有一个带有video.js的HTML5视频。我想在启动视频后更改title属性。 我的代码是:

<video id="vidid14" class="video-js vjs-default-skin" width="554" height="312" controls  poster="Picture_copyright_John_Doe.jpg" title="©John Doe" preload="none">

$(".video-js").each(function (videoIndex) {
var videoId = $(this).attr("id");
videojs(videoId).ready(function(){
this.on("play", function(e) {
this.attr('title', 'your new title'); }); });  });

但是我收到错误消息:“VIDEOJS:ERROR:TypeError:this.attr不是函数”。

没有其他任何对我有用。有没有改变代码的解决方案? 提前谢谢。

1 个答案:

答案 0 :(得分:1)

在您的示例中,this是玩家的参考。由于标题不是Player,因此发射错误。

根据您更新标题的需要,您可以使用以下任何一项。

$('#vidid14').attr('title','New Tile');

$('#vidid14_html5_api').attr('title','New Tile');

相关问题