Exemple #1
0
        public override void PrepareVideoPlayer(IPlayerManager playerManager, IList <IPlayerContext> playerContexts, PlayerContextConcurrencyMode concurrencyMode, Guid mediaModuleId,
                                                out IPlayerSlotController slotController, ref int audioSlotIndex, ref int currentPlayerIndex)
        {
            int numActive = playerContexts.Count;

            switch (concurrencyMode)
            {
            case PlayerContextConcurrencyMode.ConcurrentVideo:
                if (numActive >= 1 && playerContexts[0].AVType == AVType.Video)
                { // The primary slot is a video player slot
                    if (numActive == 1)
                    {
                        int slotIndex;
                        playerManager.OpenSlot(out slotIndex, out slotController);
                        playerManager.SwitchSlots();
                    }
                    else // numActive > 1
                    {
                        IPlayerContext pc = playerContexts[0];
                        pc.Reset(); // Necessary to reset the player context to disable the auto close function (pc.CloseWhenFinished)
                        playerManager.ResetSlot(PlayerManagerConsts.PRIMARY_SLOT, out slotController);
                    }

                    audioSlotIndex     = PlayerManagerConsts.PRIMARY_SLOT;
                    currentPlayerIndex = PlayerManagerConsts.PRIMARY_SLOT;
                    return;
                }
                break;
            }
            // All other cases are the same as in the default player open strategy
            base.PrepareVideoPlayer(playerManager, playerContexts, concurrencyMode, mediaModuleId, out slotController, ref audioSlotIndex, ref currentPlayerIndex);
        }
Exemple #2
0
        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;
        }