janusw / Camera.Maui

A CameraView Control for .NET Maui
MIT License
17 stars 3 forks source link

Recording fails on iOS 17 #1

Closed harima34 closed 5 months ago

harima34 commented 5 months ago

Hi @janusw, did you know how to make your git project compatible with .net8 ? When i add the nuget on a net8 project, the record video on iOS didn't work, the file.mov always return 0 byte

Edit: It's seems the problem is not net8 itself, is working on net8 with ios < 17 "OR" with net7 <= ios17

janusw commented 5 months ago

Hi @janusw, did you know how to make your git project compatible with .net8 ? When i add the nuget on a net8 project, the record video on iOS didn't work, the file.mov always return 0 byte

Well, the library currently targets net7.0 only, but it should actually be compatible with net8.0. I could certainly add net8.0 targets, but I'm not sure if it would solve your problem ...

Edit: It's seems the problem is not net8 itself, is working on net8 with ios < 17 "OR" with net7 <= ios17

So, negating that statement, you're saying that you only see the problem with net8.0 and ios17, right? I assume the iOS version that you're referring to is the iOS version running on the test device, right? (as opposed to the iOS version you are targeting)

If so, then it might be some sort of problem with the iOS 17 API.

AFAIK .NET 7 does not actually support iOS 17, i.e. if you build with net7.0-ios, you will be targeting the iOS 16 API in fact.

One thing that you could try: Build with net8.0-ios16.1 (instead of just net8.0-ios). If my assumptions are right, this should hopefully work for you.

harima34 commented 5 months ago

I didn't get it work neither. I checked where's the problem came from, i got error on the function FinishedRecording() at then end of the MauiCameraView.cs (in the Camera.MAUI/Apple/MauiCameraView.cs)

public void FinishedRecording(AVCaptureFileOutput captureOutput, NSUrl outputFileUrl, NSObject[] connections, NSError error) { }

As you can see on the screenshot, the file cannot be saved. I don't know what make this error, but it's related to this. I got a iphoneX on ios16 and a iphone 15 on ios17, on iphoneX both net7 and net8 are working fine, and on the iphone 15, only the net7 is working, with the net8, the file recorded is 0 bytes because if this error.

camera-maui

janusw commented 5 months ago

As you can see on the screenshot, the file cannot be saved. I don't know what make this error, but it's related to this.

Your screenshot shows this message: "The requested file name is already in use. Try a different file name or location."

So probably you cannot save to this file, because it exists already? Possibly this behavior has changed in iOS 17?

Or maybe it is not related to the iOS version at all, and this condition simply did not occur in all your tests?

harima34 commented 5 months ago

On android is working, I also changed name file, clear all file before call the recorder, but still get this error yes, as you said they maybe changed something. But I don't know what.

On Sun, Jan 14, 2024, 9:38 AM Janus Weil @.***> wrote:

As you can see on the screenshot, the file cannot be saved. I don't know what make this error, but it's related to this.

Your screenshot shows this message: "The requested file name is already in use. Try a different file name or location."

So probably you cannot save to this file, because it exists already? Possibly this behavior has changed in iOS 17?

Or maybe it is not related to the iOS version at all, and this condition simply did not occur in all your tests?

— Reply to this email directly, view it on GitHub https://github.com/janusw/Camera.Maui/issues/1#issuecomment-1890885742, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKNGH3IEBDQBEPZHOHN4BXTYOOKQDAVCNFSM6AAAAABBZOXBI6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJQHA4DKNZUGI . You are receiving this because you authored the thread.Message ID: @.***>

harima34 commented 5 months ago

So probably you cannot save to this file, because it exists already? Possibly this behavior has changed in iOS 17?

Or maybe it is not related to the iOS version at all, and this condition simply did not occur in all your tests? About my test, i just keep the same code, i changed nothing except net8, working on all devices except with iphone 15 (i only got iphoneX and 15, as i cannot upgrade my iphoneX to ios17 because will not make the updage, the iphoneX will keep working. I First tougth it was net8 the problem, but it's seems to be ios17. i found 2 post with people got the same problem on the github of hjam40. here and here. in the console i got the same message as them : [0:] Start recording result Success Thread started: #9 [0:] Stop recording result Success Thread started: #10 [0:] Video size: 0 Thread started: #11 [0:] MediaManager: Error: Cannot Open - This media may be damaged.

And for them the problem appear just after upgrade to ios17.

rdurish commented 5 months ago

@janusw do you think this is a fixable issue? I can confirm this doesn't work on IOS 17 with dotnet 8.

janusw commented 5 months ago

@harima34 Did you try the solution suggested by @blago83 in https://github.com/hjam40/Camera.MAUI/issues/122#issuecomment-1896298482? Does it fix this problem for you?

harima34 commented 5 months ago

Hi, yes I tried and its working fine.

On Thu, Jan 18, 2024, 10:20 PM Janus Weil @.***> wrote:

@harima34 https://github.com/harima34 Did you try the solution suggested by @blago83 https://github.com/blago83 in hjam40#122 (comment) https://github.com/hjam40/Camera.MAUI/issues/122#issuecomment-1896298482? Does it fix this problem for you?

— Reply to this email directly, view it on GitHub https://github.com/janusw/Camera.Maui/issues/1#issuecomment-1899221365, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKNGH3KPAQOHP6O6XRRL6RLYPGG2FAVCNFSM6AAAAABBZOXBI6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJZGIZDCMZWGU . You are receiving this because you were mentioned.Message ID: @.***>

janusw commented 5 months ago

Hi, yes I tried and its working fine.

Ah, great. If one of you is willing to create a PR with this change in my repo, I'll be happy to accept it :)

rdurish commented 5 months ago

Seems on Android API 34 there is an issue recording as well ugh.

rdurish commented 5 months ago

Working on this now. Also opening android recording issue in new API 34 I will resolve.

rdurish commented 5 months ago

@janusw pushed fix for this for your review.

janusw commented 5 months ago

I tried to reproduce this issue with Camera.MAUI.Test at version 1.4.5: I open the "MVVM Cam" page page in the Test app, tap on "Start Record" and shortly after on "Stop Record". What I found is:

So, yes, I can confirm that there are recording issues on iOS 17. However, I see those problems even with .NET 7 and not only with .NET 8.

janusw commented 5 months ago

Fixed via #4 in release 1.4.6.

janusw commented 5 months ago

Note: As mentioned above, this isssue is basically a duplicate of https://github.com/hjam40/Camera.MAUI/issues/113 and https://github.com/hjam40/Camera.MAUI/issues/122.