2021年3月9日星期二

Ionic Video Failed to load resource

So I'm having a problem in iOS, but my code works in android. This is the process... I transcode a video and I get:

"Video transcode success - "/var/mobile/Containers/Data/Application/C0611D32-4031-4F7B-BD13-7D9739D7F638/Library/Caches/output-name.mp4""

Thats the fileUri... then I take that fileURi and try to grab the base64, but I get this error: "ionic://localhost/var/mobile/Containers/Data/Application/C0611D32-4031-4F7B-BD13-7D9739D7F638/Library/Caches/output-name.mp4 - Failed to load resource: the server responded with a status of 404 ()"

Why can't it find it in iOS?

Anyone know how I can fix it?

Here is my code -

await this.videoEditor.transcodeVideo(    {        fileUri: imageData, // the path to the video on the device        outputFileName: 'output-name', // the file name for the transcoded video        //outputFileType: VideoEditorOptions.OutputFileType.MPEG4, // android is always mp4        //optimizeForNetworkUse: VideoEditorOptions.OptimizeForNetworkUse.YES, // ios only        saveToLibrary: false, // optional, defaults to true        deleteInputFile: false, // optional (android only), defaults to false        maintainAspectRatio: true, // optional (ios only), defaults to true        width: 640, // optional, see note below on width and height        height: 640, // optional, see notes below on width and height        videoBitrate: 1000000, // optional, bitrate in bits, defaults to 1 megabit (1000000)        fps: 24, // optional (android only), defaults to 24        audioChannels: 2, // optional (ios only), number of audio channels, defaults to 2        audioSampleRate: 44100, // optional (ios only), sample rate for the audio, defaults to 44100        audioBitrate: 128000, // optional (ios only), audio bitrate for the video in bits, defaults to 128 kilobits (128000)       // progress: function(info) {} // info will be a number from 0 to 100    }    ).then(async (fileUri: string) => {    this.fileUriReal = fileUri    console.log('video transcode success', fileUri)      await this.base64.encodeFile(fileUri).then((base64File: string) => {      console.log(base64File);     //does not make it to this point!      base64File = base64File.split(',').pop()      this.data = {      base64: base64File    };    }, (err) => {      console.log(err);    });      }       )    .catch((error: any) => console.log('video transcode error', error));  

Edit:

I used Filza and confirmed the transcoded video is at /var/mobile/Containers/Data/Application/C0611D32-4031-4F7B-BD13-7D9739D7F638/Library/Caches/output-name.mp4

but I'm not sure why it doesn't let me grab the base64 :/

https://stackoverflow.com/questions/66557506/ionic-video-failed-to-load-resource March 10, 2021 at 10:26AM

没有评论:

发表评论