Search Unity

Play video from URL

Discussion in 'Vuforia' started by Drymarti111, Jan 15, 2018.

  1. Drymarti111

    Drymarti111

    Joined:
    Jun 23, 2013
    Posts:
    201
    Hello Everyone!
    I am running new app using Vuforia and videoplay in Unity.

    I have huge problem as:
    upload_2018-1-15_23-30-36.png

    I made an Input where Customer can write his own URL to video.
    When I put link: http://2dsandbox.com/videoplayback.url directly to VideoPlay script it works.
    But When I try to make it by void Update in c# it shows:
    upload_2018-1-15_23-32-1.png

    It looks like it can't take "http://" in input. It shows only text to http:/ without later things:
    upload_2018-1-15_23-32-50.png

    I was trying to make code where:
    public void Update (){
    videoPlayer.url = "http://" + fieldInput.text;
    }

    But it not works as well. Even if customer has to write everything after http:// :
    (in VidePlayer it updated with http://)

    Then it shows that error:
    upload_2018-1-15_23-38-4.png

    And now... I don't know what to do. Video is not showing. As I said, it works when I put link directly to VideoPlayer url, but when I try to update it using inputfield.text it not working. Even if I put
    videoPlayer.url = "http://" + inputField.text;

    Is it because Unity didn't make it yet? Or maybe Is there a way to make input and working url?

    THANKS!
     

    Attached Files:

  2. Drymarti111

    Drymarti111

    Joined:
    Jun 23, 2013
    Posts:
    201
    Unity, are you here? ;)
     
    a9772608168 likes this.
  3. ZeFirestarter

    ZeFirestarter

    Joined:
    Oct 24, 2014
    Posts:
    17
    I would recommend that you post your entire script so we can help.

    I would also avoid changing the url in the Update Method, it is unnecessary, you don't want to update that information every frame, just when you really have to input the new information.

    Also try using https or else you will have problems in iOS versions.
    Without reading more of your code I can't figure out why it doesn't work. Just to be on the safe side define the VideoSource before changing the url and debug it.

    Code (CSharp):
    1. private void MethodName()
    2. {
    3.        videoPlayer.source = VideoSource.Url;
    4.        string newUrl = "https://" + fieldInput.text;
    5.        Debug.Log(newUrl);
    6.        videoPlayer.url = newUrl;
    7. }
     
    Last edited: Jan 30, 2018