Skip to content

Commit ef0a017

Browse files
authored
Merge pull request #53 from xibosignage/develop
Release 1.8.3
2 parents 80a0290 + 3298597 commit ef0a017

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

Control/Region.cs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ private void EvalOptions()
167167
// Store the current sequence
168168
int temp = _currentSequence;
169169

170+
// Before we can try to set the next media node, we need to stop any currently running Audio
171+
StopAudio();
172+
170173
// Set the next media node for this panel
171174
if (!SetNextMediaNodeInOptions())
172175
{
@@ -662,7 +665,7 @@ void audio_DurationElapsedEvent(int filesPlayed)
662665
{
663666
try
664667
{
665-
StopMedia(_options.Audio[_audioSequence - 1], true);
668+
StopMedia(_options.Audio[_audioSequence - 1]);
666669
}
667670
catch (Exception ex)
668671
{
@@ -678,14 +681,6 @@ void audio_DurationElapsedEvent(int filesPlayed)
678681
/// </summary>
679682
/// <param name="media"></param>
680683
private void StopMedia(Media media)
681-
{
682-
StopMedia(media, false);
683-
}
684-
685-
/// <summary>
686-
/// Stop the provided media
687-
/// </summary>
688-
private void StopMedia(Media media, bool audio)
689684
{
690685
Trace.WriteLine(new LogMessage("Region - Stop Media", "Stopping media"), LogType.Audit.ToString());
691686

@@ -705,13 +700,19 @@ private void StopMedia(Media media, bool audio)
705700
{
706701
Trace.WriteLine(new LogMessage("Region - Stop Media", "Unable to dispose. Ex = " + ex.Message), LogType.Audit.ToString());
707702
}
703+
}
708704

709-
// Stop any associated audio
710-
if (!audio && _options.Audio.Count >= _audioSequence)
705+
/// <summary>
706+
/// Stop Audio
707+
/// </summary>
708+
private void StopAudio()
709+
{
710+
// Stop the currently playing audio (if there is any)
711+
if (_options.Audio.Count > 0)
711712
{
712713
try
713714
{
714-
StopMedia(_options.Audio[_audioSequence - 1], true);
715+
StopMedia(_options.Audio[_audioSequence - 1]);
715716
}
716717
catch (Exception ex)
717718
{
@@ -794,6 +795,9 @@ public void Clear()
794795
{
795796
try
796797
{
798+
// Stop Audio
799+
StopAudio();
800+
797801
// Stop the current media item
798802
if (_media != null)
799803
StopMedia(_media);

0 commit comments

Comments
 (0)