如何在手机端中使用HTML5插入flv格式的视频
问题描述
想要在用HTML5开发的软件中的登录页面使用flv格式的视频作为背景播放,想问一下怎么实现。我查过挺多帖子都说HTML5并不支持flv格式的视频,但是又不能用MP4格式的,因为视频要放在本地安装包中,要求视频尽量不超过3M,问问大神们怎么解决这个问题。感谢
问题解答
回答1:不超过 3M ,可以通过重新解码再编码 mp4 来实现,HTML5 播放 flv 就不要考虑了,难度太大。
回答2:先说结果:可行。预览地址:我临时在个人站点上提供一个预览链接,三天后删除
http://alonesuperman.com/show...用到了b站开源的flv.jshttps://github.com/Bilibili/f...刚才自己改了下demo给你看看
<!DOCTYPE html><html><head> <meta content='text/html; charset=utf-8' http-equiv='Content-Type'> <title>flv.js demo2</title> <style>.mainContainer { display: block; width: 1024px; margin-left: auto; margin-right: auto;}.urlInput { display: block; width: 100%; margin-left: auto; margin-right: auto; margin-top: 8px; margin-bottom: 8px;}.centeredVideo { display: block; width: 100%; height: 576px; margin-left: auto; margin-right: auto; margin-bottom: auto;}.controls { display: block; width: 100%; text-align: left; margin-left: auto; margin-right: auto;} </style></head><body><p class='mainContainer'><video name='videoElement' controls autoplay height='576'> Your browser is too old which doesn’t support HTML5 video.</video><br><p class='controls'> <button onclick='flv_load()'>Load</button> <button onclick='flv_start()'>Start</button> <button onclick='flv_pause()'>Pause</button> <button onclick='flv_destroy()'>Destroy</button> <input type='text' name='seekpoint'/> <button onclick='flv_seekto()'>SeekTo</button></p> </p> <script src='https://www.haobala.com/dist/flv.js'></script><script>function flv_load() { if (flvjs.isSupported()) {var videoElement = document.getElementById(’videoElement’);var flvPlayer = flvjs.createPlayer({ type: ’flv’, url: ’1.flv’});flvPlayer.attachMediaElement(videoElement);flvPlayer.load();flvPlayer.play(); } window.player=flvPlayer;}function flv_start() { player.play();}function flv_pause() { player.pause();}function flv_destroy() { player.pause(); player.unload(); player.detachMediaElement(); player.destroy(); player = null;}function flv_seekto() { var input = document.getElementsByName(’seekpoint’)[0]; player.currentTime = parseFloat(input.value);}function getUrlParam(key, defaultValue) { var pageUrl = window.location.search.substring(1); var pairs = pageUrl.split(’&’); for (var i = 0; i < pairs.length; i++) {var keyAndValue = pairs[i].split(’=’);if (keyAndValue[0] === key) { return keyAndValue[1];} } return defaultValue;} </script> </body></html>
回答3:不存在的!!!!!
相关文章:
1. python 中对redis 操作采用装饰器进行处理,怎么做2. python - django 列表页怎样通过按钮实现调起模态框3. Python3安装selenium后下载chormdriver出现问题,大家是什么解决的4. javascript - 一个字符串转换成数字,例子就是a="2,322.222",b=’1,211.21’,如何在angualr中执行相减5. python - flask_Bootstrap的WTF的调用疑问6. mysql 存储过程7. javascript - H5 video标签可以设置亮度吗?8. windows docker-machine port9. 微信chooseImage接口部分机型选择图片后莫名其妙的跳转其他页面10. 看不懂你这一步的操作