Creating an event for network errors#28
Conversation
…isher, adding OnNetworkError event to the VimeoApi
… event in VimeoRecorder
| private void NetworkError(string response) | ||
| { | ||
| if (OnUploadFail != null) { | ||
| OnUploadFail("It seems like you are not connected to the internet, or having connection problems which disables the uploading of the video."); |
There was a problem hiding this comment.
This message is technically not accurate. Lots of vimeo api calls are in the Publisher class. Doesnt mean it failed while uploading.
Maybe simply write:
It seems like you are not connected to the internet or are having connection problems.
| if (json["invalid_parameters"][i]["field"].ToString() == "\"privacy.download\"") { | ||
| Debug.LogError("You must upgrade your Vimeo account in order to disable downloads on your video. https://vimeo.com/upgrade"); | ||
| if (OnUploadFail != null) { | ||
| OnUploadFail("You must upgrade your Vimeo account in order to access this privacy feature. https://vimeo.com/upgrade"); |
There was a problem hiding this comment.
If OnUploadFail is not implemented, then the user will never see these messages, right? Need a way to log these out regardless of the event. I see you are logging errors in VimeoRecorder.cs but what about VimeoPlayer.cs?
There was a problem hiding this comment.
I think it would make sense to have a virtual method in the VimeoAPI class that both the publisher and player can override but it will handle the logging for everyone, in the meantime I am just straight up logging it in the VimeoPlayer -> 0fa27ea
| public delegate void UploadAction(string status, float progress); | ||
| public event UploadAction OnUploadProgress; | ||
|
|
||
| public delegate void RequestAction(string response); |
There was a problem hiding this comment.
maybe name this error_message instead of response. response implies some sort of api json response
| private void NetworkError(string error_message) | ||
| { | ||
| if (OnUploadFail != null) { | ||
| OnUploadFail("It seems like you are not connected to the internet or are having connection problems."); |
| else { | ||
| JSONNode json = JSON.Parse(request.downloadHandler.text); | ||
| Debug.LogError("[VimeoApi] " + request.responseCode + " " + json["error"]); | ||
| if (OnError != null && OnNetworkError != null) { |
There was a problem hiding this comment.
Decouple this so that you can bind into either event if you want.
… from the api error callback in Vimeo api
The
VimeoAPInow implementsOnNetworkErrorevent which listens torequest.isNetworkErrorand prints an error to the console when a network error prevents you from publishing to Vimeo