Xamarin.Android VideoView AddSubtitleSource

JessaJessa TRMember ✭✭

my code is this
protected override void OnElementChanged(ElementChangedEventArgs e)
{
base.OnElementChanged(e);

        if (e.OldElement != null || Element == null)
            return;

        videoView = new Android.Widget.VideoView(Forms.Context);

        mediaController = new MediaController(Forms.Context);
        mediaController.SetMediaPlayer(videoView);
        videoView.SetMediaController(mediaController);
        videoView.AddSubtitleSource(getSubtitleSource(Element.SubTitleUrl), MediaFormat.CreateSubtitleFormat("text/srt", "tr"));
        SetNativeControl(videoView);

        videoView.SetVideoURI(Android.Net.Uri.Parse(Element.Url));
        progress = new ProgressDialog(Forms.Context, Resource.Style.progress_bar_style);
        progress.Indeterminate = true;
        progress.SetProgressStyle(ProgressDialogStyle.Spinner);
        progress.SetCancelable(false);
        progress.Show();
        progress.SetContentView(new Android.Widget.ProgressBar(Forms.Context));

        videoView.SetOnPreparedListener(this);
    }
    protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
    {
        base.OnElementPropertyChanged(sender, e);
        if (this.Element == null || this.Control == null)
            return;

        if (e.PropertyName == View_Video.UrlProperty.PropertyName)
        {
            Control.SetVideoURI(Android.Net.Uri.Parse(Element.Url));
        }

        if (Element.AutoPlay)
        {
            videoView.Start();
        }
        if (e.PropertyName == View_Video.StartStopProperty.PropertyName)
        {
            if (Element.StartStopBP == true)
                videoView.Start();
            else if (Element.StartStopBP == false)
                videoView.Pause();
        }
    }

cannot convert from 'Java.IO.InputStream' to 'System.IO.Stream'
But I get this error in the following line
videoView.AddSubtitleSource(getSubtitleSource(Element.SubTitleUrl), MediaFormat.CreateSubtitleFormat("text/srt", "tr"));

Sign In or Register to comment.