public virtual void PrepareVideoPlayer(IPlayerManager playerManager, IList <IPlayerContext> playerContexts, PlayerContextConcurrencyMode concurrencyMode, Guid mediaModuleId, out IPlayerSlotController slotController, ref int audioSlotIndex, ref int currentPlayerIndex) { int numActive = playerContexts.Count; int slotIndex; switch (concurrencyMode) { case PlayerContextConcurrencyMode.ConcurrentAudio: if (numActive > 1 && playerContexts[1].AVType == AVType.Audio) { // The secondary slot is an audio player slot slotIndex = PlayerManagerConsts.PRIMARY_SLOT; IPlayerContext pc = playerContexts[0]; pc.Reset(); // Necessary to reset the player context to disable the auto close function (pc.CloseWhenFinished) playerManager.ResetSlot(slotIndex, out slotController); audioSlotIndex = PlayerManagerConsts.SECONDARY_SLOT; } else if (numActive == 1 && playerContexts[0].AVType == AVType.Audio) { // The primary slot is an audio player slot playerManager.OpenSlot(out slotIndex, out slotController); // Make new video slot the primary slot playerManager.SwitchSlots(); audioSlotIndex = PlayerManagerConsts.SECONDARY_SLOT; } else { // No audio slot available playerManager.CloseAllSlots(); playerManager.OpenSlot(out slotIndex, out slotController); audioSlotIndex = PlayerManagerConsts.PRIMARY_SLOT; } break; case PlayerContextConcurrencyMode.ConcurrentVideo: if (numActive >= 1 && playerContexts[0].AVType == AVType.Video) { // The primary slot is a video player slot if (numActive > 1) { playerManager.CloseSlot(PlayerManagerConsts.SECONDARY_SLOT); } playerManager.OpenSlot(out slotIndex, out slotController); audioSlotIndex = PlayerManagerConsts.PRIMARY_SLOT; } else { playerManager.CloseAllSlots(); playerManager.OpenSlot(out slotIndex, out slotController); audioSlotIndex = PlayerManagerConsts.PRIMARY_SLOT; } break; default: // Don't enable concurrent controllers: Close all except the primary slot controller playerManager.CloseAllSlots(); playerManager.OpenSlot(out slotIndex, out slotController); audioSlotIndex = PlayerManagerConsts.PRIMARY_SLOT; break; } currentPlayerIndex = slotIndex; }
public virtual void PrepareAudioPlayer(IPlayerManager playerManager, IList <IPlayerContext> playerContexts, bool concurrentVideo, Guid mediaModuleId, out IPlayerSlotController slotController, ref int audioSlotIndex, ref int currentPlayerIndex) { if (concurrentVideo) { int numActive = playerManager.NumActiveSlots; // Solve conflicts - close conflicting slots if (numActive > 1) { playerManager.CloseSlot(PlayerManagerConsts.SECONDARY_SLOT); } IPlayerContext pc; if (numActive > 0 && (pc = playerContexts[PlayerManagerConsts.PRIMARY_SLOT]) != null && pc.AVType == AVType.Audio) { playerManager.CloseSlot(PlayerManagerConsts.PRIMARY_SLOT); } } else // !concurrentVideo // Don't enable concurrent controllers: Close all except the primary slot controller { playerManager.CloseAllSlots(); } // Open new slot int slotIndex; playerManager.OpenSlot(out slotIndex, out slotController); audioSlotIndex = slotController.SlotIndex; currentPlayerIndex = slotIndex; }
public virtual void PrepareVideoPlayer(IPlayerManager playerManager, IList<IPlayerContext> playerContexts, PlayerContextConcurrencyMode concurrencyMode, Guid mediaModuleId, out IPlayerSlotController slotController, ref int audioSlotIndex, ref int currentPlayerIndex) { int numActive = playerContexts.Count; int slotIndex; switch (concurrencyMode) { case PlayerContextConcurrencyMode.ConcurrentAudio: if (numActive > 1 && playerContexts[1].AVType == AVType.Audio) { // The secondary slot is an audio player slot slotIndex = PlayerManagerConsts.PRIMARY_SLOT; IPlayerContext pc = playerContexts[0]; pc.Reset(); // Necessary to reset the player context to disable the auto close function (pc.CloseWhenFinished) playerManager.ResetSlot(slotIndex, out slotController); audioSlotIndex = PlayerManagerConsts.SECONDARY_SLOT; } else if (numActive == 1 && playerContexts[0].AVType == AVType.Audio) { // The primary slot is an audio player slot playerManager.OpenSlot(out slotIndex, out slotController); // Make new video slot the primary slot playerManager.SwitchSlots(); audioSlotIndex = PlayerManagerConsts.SECONDARY_SLOT; } else { // No audio slot available playerManager.CloseAllSlots(); playerManager.OpenSlot(out slotIndex, out slotController); audioSlotIndex = PlayerManagerConsts.PRIMARY_SLOT; } break; case PlayerContextConcurrencyMode.ConcurrentVideo: if (numActive >= 1 && playerContexts[0].AVType == AVType.Video) { // The primary slot is a video player slot if (numActive > 1) playerManager.CloseSlot(PlayerManagerConsts.SECONDARY_SLOT); playerManager.OpenSlot(out slotIndex, out slotController); audioSlotIndex = PlayerManagerConsts.PRIMARY_SLOT; } else { playerManager.CloseAllSlots(); playerManager.OpenSlot(out slotIndex, out slotController); audioSlotIndex = PlayerManagerConsts.PRIMARY_SLOT; } break; default: // Don't enable concurrent controllers: Close all except the primary slot controller playerManager.CloseAllSlots(); playerManager.OpenSlot(out slotIndex, out slotController); audioSlotIndex = PlayerManagerConsts.PRIMARY_SLOT; break; } currentPlayerIndex = slotIndex; }
public virtual void PrepareAudioPlayer(IPlayerManager playerManager, IList<IPlayerContext> playerContexts, bool concurrentVideo, Guid mediaModuleId, out IPlayerSlotController slotController, ref int audioSlotIndex, ref int currentPlayerIndex) { if (concurrentVideo) { int numActive = playerManager.NumActiveSlots; // Solve conflicts - close conflicting slots if (numActive > 1) playerManager.CloseSlot(PlayerManagerConsts.SECONDARY_SLOT); IPlayerContext pc; if (numActive > 0 && (pc = playerContexts[PlayerManagerConsts.PRIMARY_SLOT]) != null && pc.AVType == AVType.Audio) playerManager.CloseSlot(PlayerManagerConsts.PRIMARY_SLOT); } else // !concurrentVideo // Don't enable concurrent controllers: Close all except the primary slot controller playerManager.CloseAllSlots(); // Open new slot int slotIndex; playerManager.OpenSlot(out slotIndex, out slotController); audioSlotIndex = slotController.SlotIndex; currentPlayerIndex = slotIndex; }