I have a hexagon shape svg element with an image as pattern inside (worker picture).
我有一个六边形svg元素,图像作为图案内部(工人图片)。
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="1400" height="1550" viewBox="0 0 140 155" class="svgMember memberPicLeft" id="erikSvg">
<defs>
<pattern id="svgImg" x="0" y="0" height="1" width="1">
<image x="-10" y="-40" width="120%" height="160% xlink:href="assets/img/picture.jpg"></image>
</pattern>
</defs>
<path fill="url(#svgImg)"
d="M69.999,153.831c-1.797,0-3.596-0.466-5.208-1.396L7.708,119.479c-3.222-1.861-5.208-5.3-5.208-9.021V44.542
c0-3.721,1.986-7.159,5.208-9.021L64.791,2.564c1.612-0.93,3.411-1.396,5.208-1.396c1.799,0,3.598,0.466,5.209,1.396l57.083,32.957
c3.224,1.861,5.21,5.3,5.21,9.021v65.916c0,3.721-1.986,7.159-5.21,9.021l-57.083,32.957
C73.596,153.365,71.797,153.831,69.999,153.831z"/>
</svg>
How can I add a video to the svg element, so that on hover the video will play masked with the element (-webkit-mask-image): contained by the element borders. I tried to just add video tag:
如何将视频添加到svg元素,以便在悬停时视频将使用元素边框包含的元素(-webkit-mask-image)进行掩码。我试着添加视频标签:
<video id="myVideo" autoplay>
<source id="mp4_src" src="assets/video/video.mp4" type="video/mp4">
</video>
This of course is not working. Didn't find any solutions on google. Thank you for any help!
这当然不起作用。没有在谷歌上找到任何解决方案。感谢您的任何帮助!
1 个解决方案
#1
0
SVG does not support the video element. I have seen some experimental builds of Opera and Firefox that have had supported it, but common browsers do not.
SVG不支持视频元素。我已经看到了一些支持它的Opera和Firefox的实验版本,但是常见的浏览器却没有。
You could attach a video as an overlay by using HTML, CSS and Javascript.
您可以使用HTML,CSS和Javascript将视频附加为叠加层。
#1
0
SVG does not support the video element. I have seen some experimental builds of Opera and Firefox that have had supported it, but common browsers do not.
SVG不支持视频元素。我已经看到了一些支持它的Opera和Firefox的实验版本,但是常见的浏览器却没有。
You could attach a video as an overlay by using HTML, CSS and Javascript.
您可以使用HTML,CSS和Javascript将视频附加为叠加层。