vimeo / vimeo-unity-sdk

Easily stream your Vimeo videos into Unity or record and publish out to Vimeo.
MIT License
210 stars 48 forks source link

A way to change the Vimeo Player url on runtime to load another video in the same Player #68

Open NiteDev opened 5 years ago

NiteDev commented 5 years ago

Describe the issue

I'm working on a project with REST calls to get the url on vimeo server, but I can't make the Vimeo Player load the url video and play it on Android using code. It 'd be great if you have a workaround or something that can help me.

Unity version

2018.3

caseypugh commented 5 years ago

That should be possible. Can you share the code you wrote that isn't working for you? Is it not working on Android only or is it the Unity Editor too?

I haven't tested this, but this should work for you:

VimeoPlayer player = gameObject.GetComponent<VimeoPlayer>();
string new_video = "https://vimeo.com/1234";
player.LoadVideo(new_video);
NiteDev commented 5 years ago

Yeah I did the same and it works on editor but when I compile on android it doesn't work .. That's why I'm confused with this, if I set the url on the Player inspector it works like a charm ... but can't make it work with code, so I think I'm missing something that is android relevant.

public IEnumerator ActivityProgressVideoLoad(string videoUrl)
    {
        yield return new WaitForEndOfFrame();

        vimeoPlayer.LoadVideo(videoUrl);
    }

Where videoURL is the REST response of the url

caseypugh commented 5 years ago

Ah, ok. Android can have some strange issues that are problems with Unity (and not the Vimeo plugin). This might help you out.

You might want to consider using AVPro Video for playback on Android, which has better cross platform playback. It also supports adaptive video playback which is important for mobile.

NiteDev commented 5 years ago

Can't make it work, I'm gonna try AVPro and tell later how it performs.