diff --git a/pages/API/get-image-info/get-image-info.uvue b/pages/API/get-image-info/get-image-info.uvue index 764a62d9bc591972bd4e2470f70659e6e56bbfc3..82f93e912d6be120d5f4953ddd45b55615b66527 100644 --- a/pages/API/get-image-info/get-image-info.uvue +++ b/pages/API/get-image-info/get-image-info.uvue @@ -52,7 +52,7 @@ uni.getImageInfo({ src: res.tempFilePaths[0], 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}`; }, fail: (err) => { diff --git a/pages/API/get-video-info/get-video-info.uvue b/pages/API/get-video-info/get-video-info.uvue index d692c702877c1f778e03abcb8c3b64f732cf0d9c..431c9a739d1d136dedae74d2fe113939f5f5ed3a 100644 --- a/pages/API/get-video-info/get-video-info.uvue +++ b/pages/API/get-video-info/get-video-info.uvue @@ -3,6 +3,13 @@ + + + 获取本地相对路径视频信息 + + + {{relativeVideoInfo}} + 获取本地绝对路径视频信息 @@ -23,12 +30,30 @@ data() { return { title: "getVideoInfo", + relativeVideoPath: "/static/test-video/10second-demo.mp4", + relativeVideoInfo: "", absoluteVideoPath: "", absoluteVideoInfo: "", // 自动化测试 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: { chooseVideo() { uni.chooseVideo({ @@ -38,7 +63,7 @@ uni.getVideoInfo({ src: res.tempFilePath, 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`; }, fail: (err) => {