提交 0bb4df65 编写于 作者: DCloud-yinjiacheng's avatar DCloud-yinjiacheng

更新media示例

上级 e8c9f6dc
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
uni.getImageInfo({ uni.getImageInfo({
src: res.tempFilePaths[0], src: res.tempFilePaths[0],
success: (_res) => { success: (_res) => {
console.log("getImageInfo success", JSON.stringify(res)); console.log("getImageInfo success", JSON.stringify(_res));
this.relativeImageInfo = `图片宽度: ${_res.width}\n图片高度: ${_res.height}\n图片路径: ${_res.path}\n图片方向: ${_res.orientation}\n图片格式: ${_res.type}`; this.relativeImageInfo = `图片宽度: ${_res.width}\n图片高度: ${_res.height}\n图片路径: ${_res.path}\n图片方向: ${_res.orientation}\n图片格式: ${_res.type}`;
}, },
fail: (err) => { fail: (err) => {
......
...@@ -3,6 +3,13 @@ ...@@ -3,6 +3,13 @@
<scroll-view style="flex:1"> <scroll-view style="flex:1">
<!-- #endif --> <!-- #endif -->
<page-head :title="title"></page-head> <page-head :title="title"></page-head>
<view class="uni-padding-wrap">
<view class="uni-title">
<text class="uni-subtitle-text">获取本地相对路径视频信息</text>
</view>
<video class="video" :src="relativeVideoPath" :controls="true"></video>
<text class="margin-top-10">{{relativeVideoInfo}}</text>
</view>
<view class="uni-padding-wrap"> <view class="uni-padding-wrap">
<view class="uni-title"> <view class="uni-title">
<text class="uni-subtitle-text">获取本地绝对路径视频信息</text> <text class="uni-subtitle-text">获取本地绝对路径视频信息</text>
...@@ -23,12 +30,30 @@ ...@@ -23,12 +30,30 @@
data() { data() {
return { return {
title: "getVideoInfo", title: "getVideoInfo",
relativeVideoPath: "/static/test-video/10second-demo.mp4",
relativeVideoInfo: "",
absoluteVideoPath: "", absoluteVideoPath: "",
absoluteVideoInfo: "", absoluteVideoInfo: "",
// 自动化测试 // 自动化测试
videoInfoForTest: null as UTSJSONObject | null videoInfoForTest: null as UTSJSONObject | null
} }
}, },
onReady() {
uni.getVideoInfo({
src: this.relativeVideoPath,
success: (res) => {
console.log("getVideoInfo success", JSON.stringify(res));
this.relativeVideoInfo = `视频画面方向: ${res.orientation}\n视频格式: ${res.type}\n视频长度: ${res.duration}s\n视频大小: ${res.size}KB\n视频宽度: ${res.width}\n视频高度: ${res.height}\n视频帧率: ${res.fps}fps\n视频码率: ${res.bitrate}kbps`;
},
fail: (err) => {
uni.showModal({
title: "获取视频信息失败",
content: JSON.stringify(err),
showCancel: false
});
}
});
},
methods: { methods: {
chooseVideo() { chooseVideo() {
uni.chooseVideo({ uni.chooseVideo({
...@@ -38,7 +63,7 @@ ...@@ -38,7 +63,7 @@
uni.getVideoInfo({ uni.getVideoInfo({
src: res.tempFilePath, src: res.tempFilePath,
success: (_res) => { success: (_res) => {
console.log("getVideoInfo success", JSON.stringify(res)); console.log("getVideoInfo success", JSON.stringify(_res));
this.absoluteVideoInfo = `视频画面方向: ${_res.orientation}\n视频格式: ${_res.type}\n视频长度: ${_res.duration}s\n视频大小: ${_res.size}KB\n视频宽度: ${_res.width}\n视频高度: ${_res.height}\n视频帧率: ${_res.fps}fps\n视频码率: ${_res.bitrate}kbps`; this.absoluteVideoInfo = `视频画面方向: ${_res.orientation}\n视频格式: ${_res.type}\n视频长度: ${_res.duration}s\n视频大小: ${_res.size}KB\n视频宽度: ${_res.width}\n视频高度: ${_res.height}\n视频帧率: ${_res.fps}fps\n视频码率: ${_res.bitrate}kbps`;
}, },
fail: (err) => { fail: (err) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册