无法在Ionic 5中播放本地视频

问题描述

我正在尝试在html5视频上播放本地录制的视频 但是每次我尝试时都会得到

无法加载资源:服务器的响应状态为404(确定) 这是我给视频标签的网址 http:// localhost:8080 / storage / emulated / 0 / DCIM / Camera / VID20201024134007.mp4

here is the video data that I'm getting when saving the video.

这是代码

let testUrl = this.videoService.localFileUrl.fullPath;
testUrl = testUrl.replace('file:///','http://localhost:8080/');
console.log("filePath=======>",testUrl)
this.filePath = testUrl;

解决方法

此问题是由以下代码行引起的:

import sys
sys.path.insert(1,'path_to_present_directory/Folder_1'
如果要访问的文件存储在服务器上,则使用

localhost。由于此文件存储在设备上,因此需要文件路径。您可以使用问题所附图片中指定的testUrl = testUrl.replace('file:///','http://localhost:8080/'); fullpath下的路径。