Ejemplo n.º 1
0
        //播放特定位置的音频
        public async void PlayMedia(int index)
        {
            mediaFilePlaying = mediaFileInfos[index];
            mediaIndex       = index;
            var stream = await mediaFilePlaying.mediaFile.OpenAsync(Windows.Storage.FileAccessMode.Read);

            MediaPlayer.SetSource(stream, mediaFilePlaying.mediaFile.ContentType);
        }
Ejemplo n.º 2
0
        //播放当前音频
        public async void PlayMedia()
        {
            if (mediaFilePlaying == null)
            {
                mediaFilePlaying = mediaFileInfos[0];
                mediaIndex       = 0;

                var stream = await mediaFilePlaying.mediaFile.OpenAsync(Windows.Storage.FileAccessMode.Read);

                MediaPlayer.SetSource(stream, mediaFilePlaying.mediaFile.ContentType);
            }
            Title.Text = mediaFilePlaying.name;
        }
Ejemplo n.º 3
0
        //播放下一音频
        public async void NextMediaAsync()
        {
            ++mediaIndex;
            if (mediaIndex >= mediaFileInfos.Count)
            {
                ;
                mediaIndex = 0;
            }
            mediaFilePlaying = mediaFileInfos[mediaIndex];
            var stream = await mediaFilePlaying.mediaFile.OpenAsync(Windows.Storage.FileAccessMode.Read);

            MediaPlayer.SetSource(stream, mediaFilePlaying.mediaFile.ContentType);

            Title.Text = mediaFilePlaying.name;
        }