我设法将新视频从Unity上传到Vimeo,但是我不知道如何替换现有视频的文件。
这是我到目前为止拥有的积木:
我在脚本中引用了VimeoRecorder组件
我的录像机已连接到AVPro录像机
我使用临时VimeoApi组件获取现有视频
然后我通过公共界面触发AVPro捕获
在当前代码中,查找具有相同名称的现有视频时,我没有做任何特别的事情,并且上载只是创建了一个具有相同名称的新视频。没有隐式替换...
以下代码:
using System;
using System.IO;
using UnityEngine;
using RenderHeads.Media.AVProMovieCapture;
using UnityEngine.Events;
using Vimeo.Recorder;
using Vimeo;
public class CaptureProxy : MonoBehaviour
{
public VimeoRecorder m_vimeoRecorder;
VimeoApi m_vimeoApi;
public CaptureBase m_movieCapture;
void Start()
{
m_movieCapture = gameObject.AddComponent<CaptureFromTexture>();
m_movieCapture._isRealTime = false;
m_movieCapture._manualUpdate = true;
m_movieCapture._useMediaFoundationH264 = true;
m_movieCapture._postCaptureSettings.writeFastStartStreamingForMp4 = true;
m_vimeoRecorder.avproEncoder = m_movieCapture;
m_vimeoApi = gameObject.AddComponent<VimeoApi>();
m_vimeoApi.token = m_vimeoRecorder.GetVimeoToken();
m_vimeoApi.OnRequestComplete += VimeoGetVideosComplete;
m_vimeoApi.OnError += OnVimeoRequestError;
m_vimeoApi.GetVideosInFolder(m_vimeoRecorder.currentFolder);
}
private void VimeoGetVideosComplete(string response)
{
m_vimeoApi.OnRequestComplete -= VimeoGetVideosComplete;
m_vimeoApi.OnError -= OnVimeoRequestError;
Destroy(m_vimeoApi);
var json = Vimeo.SimpleJSON.JSONNode.Parse(response);
Vimeo.SimpleJSON.JSONNode videoData = json["data"];
if (videoData.Count > 0)
{
for (int i = 0; i < videoData.Count; i++)
{
VimeoVideo video = new VimeoVideo(videoData[i]);
if (video.name.StartsWith(m_recordParams.filetag))
{
Debug.LogWarning("Video already exists at url: " + video.uri);
// And that's what I know so far
// I would like to give the VimeoVideo object to m_videoRecorder for it to upload the video file to the same entry
}
}
}
}
public void StartCapture()
{
// starts the capture
m_movieCapture.StartCapture();
}
public void StopCapture()
{
// stops the capture, and triggers Vimeo upload
m_movieCapture.StopCapture();
}
}
答案 0 :(得分:0)
很遗憾,Vimeo Unity SDK当前不支持视频文件替换。但是,此功能在Vimeo的API中可用。 visit this page登录到Vimeo帐户后,了解如何修改Unity SDK来替换Vimeo视频。
也可以随时提交feature request on Github。