javascript实现blob加密视频源地址
Posted phperlinxinlan
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript实现blob加密视频源地址相关的知识,希望对你有一定的参考价值。
一、html代码:
<video id="my-video" class="video-js" playsinline controls preload="auto" controlslist="nodownload" controlslist="nofullscreen" width="100%" height="240" poster="upload/moviepic/2019-08-02/1564739500xyzp.png" data-setup=""> <source src="" type="video/mp4"> <source src="" type="video/ogg"> <source src="" type="video/webm"> <p class="vjs-no-js"> To view this video please enable javascript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a> </p> </video>
二、JavaScript代码:
<script type="text/javascript"> var video = document.getElementById("my-video"); window.URL = window.URL || window.webkitURL; var xhr = new XMLHttpRequest(); var play_url = ‘test.mp4‘; xhr.open("GET", play_url, true); xhr.responseType = "blob"; xhr.onload = function() if (this.status == 200) var blob = this.response; console.log(blob); video.onload = function(e) window.URL.revokeObjectURL(video.src); ; video.src = window.URL.createObjectURL(blob); xhr.send(); </script>
三、效果图如下:
以上是关于javascript实现blob加密视频源地址的主要内容,如果未能解决你的问题,请参考以下文章