我正在使用 Video-react ( https://video-react.js.org/components/player/ ),在页面上,它说我可以this.refs.player.load()
在更新其源代码后使用。但我认为不再支持该方法,因为它根本不起作用,而且我在使用 npm 下载的源代码中找不到它。
还有其他方法可以做到这一点或有人找到解决方案吗?这是我的部分代码:
var videoRow = document.createElement("div");
videoRow.className = 'col-md-4';
videoRow.setAttribute("id", "videoRows");
//create the myPlayer div which will contain the Player.
var myPlayerDiv = document.createElement("div");
myPlayerDiv.setAttribute("id", "myPlayer");
//create my player with the information from the attributes.
var videoPlayer = document.createElementNS('', 'Player');
videoPlayer.setAttribute("src", data.val().videoURL);
videoPlayer.setAttribute("ref","player");
myPlayerDiv.appendChild(videoPlayer);
videoRow.appendChild(myPlayerDiv);
document.getElementById('videoList').appendChild(videoRow);
this.refs.player.load();
这没有奏效。我尝试重命名 ref 但仍然没有。div 显示但播放器不显示。
编辑:刚刚在 Player.js 组件中找到了这个,但不知道如何实现它:Player.js 组件源代码