前端实现视频播放添加水印

一、效果如下

在这里插入图片描述

二、代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
	<style>
		.container {
			position: relative;
		}
		.base {
			width: 300px;
			height: 200px; 
			background-color: gray;
		}
		.canvas {
			position: absolute;
			width: 300px;
			height: 200px; 
			top: 0;
			left: 0;
			z-index: 999;
		}
	</style>

	<div class="container">
		<video class="base" src="https://www.w3school.com.cn/example/html5/mov_bbb.mp4" autoplay muted></video>

		<canvas id="canvas" class="canvas"></canvas>
	</div>

    <script>
    	
    	function canvas() {
			var canvas = document.getElementById('canvas');
			var ctx = canvas.getContext('2d');
			ctx.font = '30px Arial';
			ctx.fillStyle = '#000000';
			ctx.fillText('Hello World', 70, 70);
    	}

    	canvas()

    </script>
</body>
</html>

三、视频添加水印

现在实现的只是观看视频时有水印,实际视频没有任何变化,想要实现视频添加水印,还需要用ffmpeg,感兴趣的可以去了解下

相关推荐

  1. 实习随笔【前端技术实现全局添加水印

    2024-07-21 02:24:02       18 阅读
  2. vue前端播放视频

    2024-07-21 02:24:02       28 阅读
  3. SpringBoot实现PDF添加水印

    2024-07-21 02:24:02       43 阅读
  4. SpringBoot 实现 PDF 添加水印

    2024-07-21 02:24:02       51 阅读
  5. SpringBoot实现 PDF 添加水印

    2024-07-21 02:24:02       34 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-21 02:24:02       52 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-21 02:24:02       54 阅读
  3. 在Django里面运行非项目文件

    2024-07-21 02:24:02       45 阅读
  4. Python语言-面向对象

    2024-07-21 02:24:02       55 阅读

热门阅读

  1. Next.js静态导出与动态路由优化

    2024-07-21 02:24:02       21 阅读
  2. 分治算法(算法篇)

    2024-07-21 02:24:02       17 阅读
  3. 【时时三省】(C语言基础)选择语句和循环语句

    2024-07-21 02:24:02       17 阅读
  4. 跨平台webSocket模块设计技术解决方案

    2024-07-21 02:24:02       18 阅读
  5. Angular之store全局状态管理 浅学

    2024-07-21 02:24:02       20 阅读
  6. 暗网与深网的技术原理、应用及社会影响探究

    2024-07-21 02:24:02       17 阅读
  7. Spring Cloud Gateway 响应数据加密

    2024-07-21 02:24:02       21 阅读
  8. HTTP爬虫IP流量和数量计费模式选择指南

    2024-07-21 02:24:02       20 阅读