Ejemplo n.º 1
0
            private void StartMusicOnHoldPlayback(object sender, AudioVideoFlowConfigurationRequestedEventArgs args)
            {
                _mohServer._mohPlayer.AttachFlow(args.Flow);
                _mohServer._mohPlayer.StateChanged += this.OnPlayerStateChanged;

                _mohServer._mohFileSource.BeginPrepareSource(
                    MediaSourceOpenMode.Buffered,
                    ar =>
                {
                    WmaFileSource fileSource = ar.AsyncState as WmaFileSource;

                    try
                    {
                        fileSource.EndPrepareSource(ar);

                        _mohServer._mohPlayer.Start();
                    }
                    catch (OperationFailureException ex)
                    {
                        _mohServer.BeginShutDown(
                            sar =>
                        {
                            AcdMusicOnHoldServer mohServer = sar.AsyncState as AcdMusicOnHoldServer;

                            mohServer.EndShutDown(sar);
                        },
                            _mohServer);

                        this.SetAsCompleted(ex, false);
                    }
                },
                    _mohServer._mohFileSource);
            }
Ejemplo n.º 2
0
            internal void Process()
            {
                _mohServer._mohFileSource.BeginPrepareSource(
                    MediaSourceOpenMode.Buffered,
                    ar =>
                {
                    WmaFileSource fileSource = ar.AsyncState as WmaFileSource;

                    try
                    {
                        fileSource.EndPrepareSource(ar);

                        _mohServer._mohPlayer.Start();
                        lock (_mohServer._syncRoot)
                        {
                            _mohServer.UpdateState(MusicOnHoldServerState.Started);
                        }
                        this.SetAsCompleted(null, false);
                    }
                    catch (OperationFailureException ex)
                    {
                        _mohServer.BeginShutDown(
                            sar =>
                        {
                            AcdMusicOnHoldServer mohServer = sar.AsyncState as AcdMusicOnHoldServer;

                            mohServer.EndShutDown(sar);
                        },
                            _mohServer);

                        this.SetAsCompleted(ex, false);
                    }
                },
                    _mohServer._mohFileSource);
            }