首页 > 解决方案 > 如何在xamarin跨平台表单c#中一个接一个地播放多个视频

问题描述

如何在xamarin跨平台表单c#中一个接一个地播放多个视频我尝试过使用列表,数组,但问题是最后一个视频只播放,其余视频不播放。

        MediaQueue mq = new MediaQueue();
        MediaFile mf = new MediaFile();
        if (PlayStopButtonText.Text == "Play")
        {
     /*string videoUrl1 = "https://archive.org/download/BigBuckBunny_328/BigBuckBunny_512kb.mp4";
         string videoUrl = "https://sec.ch9.ms/ch9/e68c/690eebb1-797a-40ef-a841-c63dded4e68c/Cognitive-Services-Emotion_high.mp4";
         CrossMediaManager.Current.Play(videoUrl,MediaFileType.Video,ResourceAvailability.Remote);
            //CrossMediaManager.Current.PlayNext();*/
            mf.Url = videoUrll;
            mf.Type = MediaFileType.Video;
            mq.Insert(0,mf);
            mf.Url = videoUrl;
            mf.Type = MediaFileType.Video;
            mq.Insert(1, mf);
            foreach(var item in mq)
            {
            CrossMediaManager.Current.Play(item.Url,MediaFileType.Video);
            }
        }

标签: androidios.netxamarin.formscross-platform

解决方案


推荐阅读