当前位置: 首页>>代码示例>>C#>>正文


C# MediaPlayer.Play方法代码示例

本文整理汇总了C#中MediaPlayer.Play方法的典型用法代码示例。如果您正苦于以下问题:C# MediaPlayer.Play方法的具体用法?C# MediaPlayer.Play怎么用?C# MediaPlayer.Play使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MediaPlayer的用法示例。


在下文中一共展示了MediaPlayer.Play方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RunTests

 public static void RunTests() {
     var player = new MediaPlayer();
     player.Play();
     player.Pause();
     player.Stop();
     player.AllSongs.TrackNames.PrintCollection();
 }
开发者ID:JohnPaine,项目名称:learning,代码行数:7,代码来源:LazyInstantiation.cs

示例2: MediaPlayer_MediaOpened

 /// <summary>
 /// Fired when MediaPlayer is ready to play the track
 /// </summary>
 void MediaPlayer_MediaOpened(MediaPlayer sender, object args)
 {
     // wait for media to be ready
     sender.Play();
     Debug.WriteLine("New Track" + this.CurrentTrackName);
     TrackChanged.Invoke(this, CurrentTrackName);
 }
开发者ID:MichaelAi,项目名称:Aural-Player,代码行数:10,代码来源:BackgroundPlaylist.cs

示例3: Scenario8_Loaded

        private void Scenario8_Loaded(object sender, RoutedEventArgs e)
        {
            mediaPlayer = new MediaPlayer();
            mediaPlayer.Source = MediaSource.CreateFromUri(rootPage.CaptionedMediaUri);
            mediaPlayer.Play();

            // Bind to the element in the Loaded event after the layout 
            // pass has run and sized elements
            BindMediaPlayerToUIElement(mediaPlayer, mediaPlayerButton);
        }
开发者ID:huoxudong125,项目名称:Windows-universal-samples,代码行数:10,代码来源:Scenario7_VideoComposition.xaml.cs

示例4: HandleMediaPlayerMediaOpened

        void HandleMediaPlayerMediaOpened(MediaPlayer sender, object args)
        {
            if (isFirstOpen)
            {
                isFirstOpen = false;
                double percentage = ApplicationSettings.GetSettingsValue<double>(ApplicationSettings.CURRENT_TRACK_PERCENTAGE, 0.0);
                ApplicationSettings.PutSettingsValue(ApplicationSettings.CURRENT_TRACK_PERCENTAGE, 0.0);

                if (percentage > 0)
                {
                    Logger.Current.Init(LogType.PlayAction);

                    Logger.Current.Log(new CallerInfo(), LogLevel.Info, "Length Total {0}", mediaPlayer.NaturalDuration.Ticks);

                    mediaPlayer.Position = TimeSpan.FromTicks((long)(mediaPlayer.NaturalDuration.Ticks * percentage));
                }
            }

            int trackId = ApplicationSettings.GetSettingsValue<int>(ApplicationSettings.CURRENT_PLAYQUEUE_POSITION, 0);
            Logger.Current.Init(LogType.PlayAction);

            Logger.Current.Log(new CallerInfo(), LogLevel.Info, "Trying to play row {0}", trackId);

            playingTrack = TrackInfo.TrackInfoFromRowId(trackId);
            TrackChanged.Invoke(this, playingTrack);

            if (playAfterOpen)
            {
                sender.Play();
            }
            else
            {
                playAfterOpen = true;
            }
        }
开发者ID:jevonsflash,项目名称:ProjectMato,代码行数:35,代码来源:PlayQueueManager.cs

示例5: MediaPlayer_MediaOpened

 /// <summary>
 /// Fired when MediaPlayer is ready to play the track
 /// </summary>
 void MediaPlayer_MediaOpened(MediaPlayer sender, object args)
 {
     // wait for media to be ready
     sender.Play();
     TrackChanged.Invoke(this, null);
 }
开发者ID:robUx4,项目名称:vlc-winrt,代码行数:9,代码来源:BackgroundTrackCollection.cs

示例6: MediaPlayer_MediaOpened

 private void MediaPlayer_MediaOpened(MediaPlayer sender, object args)
 {
     logger.LogMessage("BackgroundAudio: File opened - start playing.");
     sender.Volume = 0; // Will be set to 1 in MediaPlayer_CurrentStateChanged handler
     sender.Play();
     smtc.PlaybackStatus = MediaPlaybackStatus.Playing;
     smtc.DisplayUpdater.Type = MediaPlaybackType.Music;
     smtc.DisplayUpdater.MusicProperties.Title = playlist.CurrentTrack?.Name ?? string.Empty;
     smtc.DisplayUpdater.MusicProperties.Artist = playlist.CurrentTrack?.Artist ?? string.Empty;
     smtc.DisplayUpdater.MusicProperties.AlbumArtist = playlist.CurrentTrack?.AlbumArtist ?? string.Empty;
     smtc.DisplayUpdater.Update();
 }
开发者ID:starkole,项目名称:AsotListener,代码行数:12,代码来源:AudioManager.cs

示例7: MediaPlayerOnMediaOpened

        void MediaPlayerOnMediaOpened(MediaPlayer sender, object args)
        {
            Debug.WriteLine("MediaPlayerManager.MediaPlayerOnMediaOpened()");

            if (_position.HasValue)
            {
                if (sender.CanSeek)
                    sender.Position = _position.Value;

                _position = null;
            }

            sender.Play();

            if (null == _closePlaybackCompleted)
                FireTrackChanged();
        }
开发者ID:henricj,项目名称:phonesm,代码行数:17,代码来源:MediaPlayerManager.cs

示例8: _mediaPlayer_MediaOpened

 void _mediaPlayer_MediaOpened(MediaPlayer sender, object args)
 {
     sender.Play();
     
     TrackChanged?.Invoke(this, CurrentTrack);
 }
开发者ID:nemecek-f,项目名称:MusictasticReborn,代码行数:6,代码来源:QueueManager.cs

示例9: Main

    static void Main(string[] args)
    {
        Console.WriteLine("***** Fun with Lazy Instantiation *****\n");

            // No allocation of AllTracks object here!
            MediaPlayer myPlayer = new MediaPlayer();
            myPlayer.Play();

            // Allocation of AllTracks happens when you call GetAllTracks().
            MediaPlayer yourPlayer = new MediaPlayer();
            AllTracks yourMusic = yourPlayer.GetAllTracks();

            Console.ReadLine();
    }
开发者ID:wordtinker,项目名称:c-sharp,代码行数:14,代码来源:Program.cs

示例10: MediaPlayer_MediaOpened

        /// <summary>
        ///     Fired when MediaPlayer is ready to play the track
        /// </summary>
        private void MediaPlayer_MediaOpened(MediaPlayer sender, object args)
        {
            _retryCount = 0;

            // wait for media to be ready
            sender.Play();

            if (CurrentTrack == null) return;

            if (TrackChanged != null)
                OnTrackChanged(CurrentTrack.SongId);

            OnTrackChanged();
        }
开发者ID:jayharry28,项目名称:Audiotica,代码行数:17,代码来源:QueueManager.cs

示例11: Run

 public void Run()
 {
     this.Children.Add(loading = new Loading() { Z = 999999 });
     loading.Show();
     this.Width = Application.Current.Host.Content.ActualWidth;
     this.Height = Application.Current.Host.Content.ActualHeight;
     this.Children.Add(music = new MediaPlayer() { Loop = true, Uri = "Login" }); music.Play();
     this.Children.Add(head = new EntityObject() { Source = GlobalMethod.GetImage("UI/LoginBack.jpg", UriType.Project), Stretch = Stretch.Fill, IsVisible = false, Z = 6, });
     this.Children.Add(backgroundFirst = new LoginBackground());
     this.Children.Add(backgroundSecond = new LoginBackground());
     this.Children.Add(foot = new EntityObject() { Source = GlobalMethod.GetImage("UI/LoginBack.jpg", UriType.Project), Stretch = Stretch.Fill, IsVisible = false, Z = 6, });
     LoginBackground.Interval = 110000;
     backgroundFirst.Run(BackgourndIndex.First, 0, -(Application.Current.IsRunningOutOfBrowser ? 2172 : backgroundFirst.RealWidth));
     backgroundSecond.Run(BackgourndIndex.Second, backgroundSecond.RealWidth - 1, -(Application.Current.IsRunningOutOfBrowser ? 2172 : backgroundFirst.RealWidth));
     //下载动画信息包
     ParallelDownloader downloader = new ParallelDownloader();
     downloader.OpenReadCompleted += new OpenReadCompletedEventHandler(animationInfo_OpenReadCompleted);
     downloader.OpenReadAsync(GlobalMethod.WebPath("Animation/Info.xml"), DownloadPriority.Highest, null, false, 0);
 }
开发者ID:Gallardot,项目名称:GallardotStorage,代码行数:19,代码来源:LoginManager.cs


注:本文中的MediaPlayer.Play方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。