예제 #1
0
 protected void Init(MusicStream Wave)
 {
     _player = new MediaElement
     {
         IsMuted   = false,
         Position  = new TimeSpan(0, 0, 0),
         Volume    = Wave.Volume,
         IsLooping = Wave.Loop,
     };
     _player.SetSource(Wave.Content.AsRandomAccessStream(), Wave.MimeType);
 }/*
예제 #2
0
        protected async Task Init(string FilePath, bool Loop, double Volume)
        {
            // await Current.InstalledLocation.GetFolderAsync(FolderName);
            StorageFile file = await StorageFile.GetFileFromPathAsync(FilePath);

            IRandomAccessStream stream = await file.OpenAsync(FileAccessMode.Read);

            _player = new MediaElement
            {
                IsMuted   = false,
                Position  = new TimeSpan(0, 0, 0),
                Volume    = Volume,
                IsLooping = Loop
            };
            _player.SetSource(stream, file.ContentType);
        }