How to get length of video url

Im trying to make it so you can basically stream a video from the web but I need the total length for a slider.

        double maxTime = (videoPlayer.frameCount / videoPlayer.frameRate);
        System.TimeSpan VideoUrlLength = System.TimeSpan.FromSeconds(maxTime);
        string minutes = (VideoUrlLength.Minutes).ToString("00");
        string seconds = (VideoUrlLength.Seconds).ToString("00");
        TotalMinutes.text = minutes;
        TotalSeconds.text = seconds;

It gives me this error:

"ArgumentException: TimeSpan does not accept floating point Not-a-Number values.
System.TimeSpan.Interval (System.Double value, System.Int32 scale) (at <6073cf49ed704e958b8a66d540dea948>:0)
System.TimeSpan.FromSeconds (System.Double value) (at <6073cf49ed704e958b8a66d540dea948>:0)
OnlineVideoLoader.VideoTime () (at Assets/Scripts/OnlineVideoLoader.cs:45)
OnlineVideoLoader.Update () (at Assets/Scripts/OnlineVideoLoader.cs:32)
"

My void Start:

void Start()
    {
        videoPlayer.url = videoUrl;
        videoPlayer.audioOutputMode = VideoAudioOutputMode.AudioSource;
        videoPlayer.EnableAudioTrack(0, true);
        videoPlayer.Prepare();
    }

My void Update:

    private void Update()
        {
            VideoTime();
        }

I’ve worked quite a lot with compressed audio and, unless there is some metadata in the header, it very difficult to determine the duration of a file without reading it all in, which clearly, you can’t do with streaming. Unless someone comes up with a brilliant idea or unless you can read the video metadata, I think you’re out of luck.

Your Video first Needed Prepared

void VideoPlay(string path)
{
Player.url = path;
Player.EnableAudioTrack(0, true);
Player.Prepare();
Player.prepareCompleted += Prepared;
Player.Play();
}

void Prepared(VideoPlayer vPlayer)
{
    double maxTime = (Player.frameCount / Player.frameRate);
    VideoSlider.maxValue = (float)maxTime;
}