DPlayer视频水印
当前用的是DPlayer视频播放器,我们如何对视频增加水印,求解答
要在DPlayer视频播放器中添加水印,您可以通过以下步骤实现:
<!DOCTYPE html>
<html>
<head>
<title>DPlayer水印示例</title>
<style>
.watermark {
position: absolute;
top: 10px;
right: 10px;
font-size: 18px;
color: white;
text-shadow: 1px 1px 1px black;
z-index: 9999;
}
</style>
</head>
<body>
<div id="dplayer-container"></div>
<script src="https://cdn.jsdelivr.net/npm/dplayer/dist/DPlayer.min.js"></script>
<script>
var dp = new DPlayer({
container: document.getElementById('dplayer-container'),
video: {
url: 'your-video-url.mp4',
},
});
// 创建水印元素
var watermark = document.createElement('div');
watermark.className = 'watermark';
watermark.innerText = '水印文本';
// 将水印添加到DPlayer播放器
document.getElementById('dplayer-container').appendChild(watermark);
</script>
</body>
</html>
此例子创建了一个具有'watermark'类的