-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for replacing Vimeo video (Issue #55) #66
base: master
Are you sure you want to change the base?
Conversation
… Matt Shoen,s: don't use the overloaded JSON symbol, and use a more explicit JSONNode class reference JSONNode node = JSONNode.Parse(jsonString); makes more sense than: JSONNode node = JSON.Parse(jsonString);
…sage from the Vimeo server - Added to VimeoRecorder Editor GUI - Added a replaceExisting boolean field to VimeoRecorder Went according to documentation in: https://developer.vimeo.com/api/upload/videos#replacing-a-source-file But I get this error: [VimeoApi] 401 Unauthorized request. Are you using a valid token? Actually it makes sense, as it is quite weird that the documentation doesn't specify to add the authorization token in the header. So, I added it and I still get another error: [VimeoApi] https://api.vimeo.com/videos/307965347/versions - {"error":"Something strange occurred. Please try again.","link":null,"developer_message":"The body of this HTTP request is not formatted properly. Please check the content-type header and raw body.","error_code":2205}
…sage from the Vimeo server - Added to VimeoRecorder Editor GUI - Added a replaceExisting boolean field to VimeoRecorder Went according to documentation in: https://developer.vimeo.com/api/upload/videos#replacing-a-source-file But I get this error: [VimeoApi] 401 Unauthorized request. Are you using a valid token? Actually it makes sense, as it is quite weird that the documentation doesn't specify to add the authorization token in the header. So, I added it and I still get another error: [VimeoApi] https://api.vimeo.com/videos/307965347/versions - {"error":"Something strange occurred. Please try again.","link":null,"developer_message":"The body of this HTTP request is not formatted properly. Please check the content-type header and raw body.","error_code":2205}
Finally got a chance to check out your PR. This looks pretty good so far! Your code still doesn't seem to pass the token in since it is setting the bearer token to When I set it to It did uncover more bugs in the post-processing part though, but those seem like easy fixes. One fix is to update // JSONNode video = { "duration": null }
if (video["duration"] != null) // this returns true (wrong)
if (video["duration"] != null && !video["duration"].IsNull) // this returns false (correct) |
Also, you should try passing in just the file name and not the |
…rror message from the Vimeo server" This reverts commit 9cc33f5.
…bearer token to false Set it to true
…ed just as a way to show a unique name for the new uploaded version.
Hey Casey Thanks a lot for the tips. OK your remarks all make sense and I committed the changes, but I'm still getting an error. Actually I got several kinds of errors, every time it is different:
In my test, I use the "Recorder" test scene, where I create a starfield video inside Project "Test". I set the privacy to "Only me". I named the video "Flying vees". That goes well, Then when I try to replace these are the errors I get, although I select the existing video correctly The questions I have are:
|
I'm not sure how to help you if your result is inconsistent every time. Are you able to reproduce the same error state consistently? I do get this error every time: {"error":"The requested video could not be found"} But the video still gets replaced. Did you see if your video got replaced, despite the error showing up? I think this error exists because it is trying to To answer your Qs:
|
…bug was returning the version id instead of the video id. Plus the null JSON node test needed a fix in more places.
OK you're right, well, almost. The video did get replaced, after I just got the "The requested video could not be found" error. But the next replacements will fail. Read till the end cause it seems your suggestion did solve the problem, although with some weird things on the way. However. on the second time, I got the same error message and the video did not get replaced (it didn't open the browser window, and instead opened the Windows file explorer. Also the final message after the error was weird, with just this: And, on the next try, I did get a different error: Note that between the 1st and second try, I re-ran the game and I had to get another token from Vimeo to sign in (I requested the previous one while in game running mode so the Unity editor did not remember it). The first successful attempt was while staying in the same sign-in session (and even the same game session) between the first new recording and the second one with replacement. And at the 3rd time, boom, after I requested a new token from Vimeo, I started again the game, recorded with replacing flag on, and I got the 3rd error about the wrong password. Also, I looked and set a breakpoint at the line you mention, and I indeed see something weird, actually 2 things: So... I went ahead and made a fix for the regex issue (just removed the $ as the video id may not be at the end of the uri string). And.. it seems to fix the problem! Now I can replace the video again and again. That's what I got so far. Yes the replacement happens the first time, in spite of the error message, but then in the 2nd replacement and beyond you start to get the weird errors. If you fix the regex bug it fixes all the error messages and the video seems to be replaced consistently. Can we celebrate ? |
And BTW, replacing the video name does work. |
Hooray! Glad you were able to finally get it working |
… to fetch updated videos list from vimeo at run-time, rather than relying on a refresh in the editor. So I had to take a chunk of code from BaseEditor class and create a VideoFetcher run-time class, and use the factorized code in VimeoRecorder.
- BaseEditor should refer to the new VimeoFetcher rather than VimeoApi - reorder inspector fields
# Conflicts: # Assets/Vimeo/Scripts/Config/PlayerSettings.cs # Assets/Vimeo/Scripts/Config/VimeoVideo.cs # Assets/Vimeo/Scripts/Editor/BaseEditor.cs # Assets/Vimeo/Scripts/Editor/VimeoRecorderEditor.cs # Assets/Vimeo/Scripts/Recorder/VimeoPublisher.cs # Assets/Vimeo/Scripts/Recorder/VimeoRecorder.cs # Assets/Vimeo/Scripts/Services/VimeoApi.cs # Assets/Vimeo/Scripts/Services/VimeoUploader.cs
Just merged master into this branch, to make life easier for vimeo repo owners. I specially tried to respect Vimeo SDK's coding style convention. I thought I will give a summary here of what this feature provides:
|
…ng quotas limit) Signed-off-by: Michael Boccara <michael@smartertv.net>
…ideo. 2- Make sure to keep description unchanged. 3- Added capability to edit description when publishing videos. 4- Add support for paged request, for example when returning a list of more than 100 videos. 5- Update videos list after upload, in case we changed the video name or description
+ more callbacks in VimeoRecorder
So the player works properly with Unity WebGL now? Which one should i use this one , or the main one? |
WIP: Partial fix for Issue #55
Add support for replacing existing video. But I get an error message from the Vimeo server
Went according to documentation in:
https://developer.vimeo.com/api/upload/videos#replacing-a-source-file
But I get this error:
[VimeoApi] 401 Unauthorized request. Are you using a valid token?
Actually it makes sense, as it is quite weird that the documentation doesn't specify to add the authorization token in the header.
So, I added it, but then I still get another error:
[VimeoApi] https://api.vimeo.com/videos/307965347/versions - {"error":"Something strange occurred. Please try again.","link":null,"developer_message":"The body of this HTTP request is not formatted properly. Please check the content-type header and raw body.","error_code":2205}