VUE获取视频或音频时长
发布时间:2021-01-27, 00:04:20 分类:HTML | 编辑 off 网址 | 辅助
图集1/1
正文 552字数 1,030,210阅读
<div>
<audio ref="audio" @timeupdate="updateTime" autoplay controls src=""></audio>
<video ref="video"
@canplay="getDuration"
src=""
width="80%" height="350"
controls="controls"
>
</video>
</div>
javaScript:
updateTime(){
let s=this.$refs.audio.currentTime;//获取当前播放时间
console.log(s)
},
getDuration(){
let s=this.$refs.video.duration ;//获取视频的总时长
console.log(s)
},
Run code
Cut to clipboard
(支付宝)给作者钱财以资鼓励 (微信)→
有过 7 条评论 »
强制换行
1、word-break: break-all; 只对英文起作用,以字母作为换行依据。 2、word-wrap: break-word; 只对英文起作用,以单词作为换行依据。 3、white-space: pre-wrap; 只对中文起作用,强制换行。
禁止换行
white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
图标在1秒内匀速旋转360度
.close:hover::before{ -webkit-transform:rotate(360deg); transform:rotate(360deg); -webkit-transition:-webkit-transform 1s linear; transition:transform 1s linear; }
一直不停旋转
@-webkit-keyframes spin { from { -webkit-transform: rotate(0deg); } to { -webkit-transform: rotate(360deg); } } @keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.close:hover::before { /*-webkit-transform: rotate(360deg); transform: rotate(360deg); -webkit-transition: -webkit-transform 1s linear; transition: transform 1s linear;*/ -webkit-animation: spin 1s linear 1s 5 alternate; animation: spin 1s linear infinite; }
animation动画添加各种参数 (1)infinite参数,表示动画将无限循环。在速度曲线和播放次数之间还可以插入一个时间参数,用以设置动画延迟的时间。如希望使图标在1秒钟后再开始旋转,并旋转两次,代码如下 .close:hover::before{ -webkit-animation: spin 1s linear 1s 2; animation: spin 1s linear 1s 2; } (2)alternate参数。animation动画中加入反向播放参数alternate。在加入该参数后,动画将在偶数次数时反向播放动画。 .close:hover::before{ -webkit-animation: spin 1s linear 1s 2 alternate; animation: spin 1s linear 1s 2 alternate; }
<?php function check_remote_file_exists($url) { $curl = curl_init($url); // 不取回数据 curl_setopt($curl, CURLOPT_NOBODY, true); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET'); // 发送请求 $result = curl_exec($curl); $found = false; // 如果请求没有发送失败 if ($result !== false) { /** 再检查http响应码是否为200 */ $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); if ($statusCode == 200) { $found = true; } } curl_close($curl); return $found; } $url = "http://cn.wordpress.org/wordpress-3.3.1-zh_CN.zip"; echo check_remote_file_exists($url); // 返回1,说明存在。 ?>
url编码(urlencode)
自动加载 //再此运行composer dump-autoload,尝试调用 "autoload":{ "files":["aa/bb.php”],////不需要命名空间 } //files键对应的值是一个数组,数组元素是文件的路径,路径是相对于应用的根目录。加上上述内容后,运行命令:
一、取整 1. 取整 // 丢弃小数部分,保留整数部分 parseInt(7/2) // 3 2. 向上取整 // 向上取整,有小数就整数部分加1 Math.ceil(7/2) // 4 3. 向下取整 // 向下取整,丢弃小数部分 Math.floor(7/2) // 3 4. 四舍五入 // 四舍五入 Math.round(7/2) // 3 二、取余 // 1. 取余 7%2 // 1