Mikasuki
Mikasuki

Reputation: 35

XAML Object reference not set to an instance of an object

The error is occurred in: meTestVideo.Source = url.Uri; I think I forgot something. I supposed to create a Object? Sorry for my ignorance guys this is my first time programing in xaml.

public string Uri { get; set; } 

private async void PlayVideo()
{
        string VideoUrl = "http://www.youtube.com/watch?v=2rJwYN_SmOU";
        var url = await YouTube.GetVideoUriAsync(VideoUrl, YouTubeQuality.Quality360P);
        meTestVideo.Source = url.Uri;
}

Upvotes: 1

Views: 439

Answers (1)

ROMAN
ROMAN

Reputation: 1576

You need to use YouTube Video Id in the parameter.

public string Uri { get; set; } 

    private async void PlayVideo()
    {
            string VideoUrl = "http://www.youtube.com/watch?v=2rJwYN_SmOU";
            var url = await YouTube.GetVideoUriAsync("2rJwYN_SmOU", YouTubeQuality.Quality360P);
            meTestVideo.Source = url.Uri;
    }

Upvotes: 1

Related Questions