private urakawa.media.ExternalAudioMedia GetExternalAudioMedia(urakawa.core.TreeNode node)
        {
            List <urakawa.property.channel.Channel> channelsList = m_Presentation.ChannelsManager.GetChannelsByName(PUBLISH_AUDIO_CHANNEL_NAME);

            if (channelsList == null || channelsList.Count == 0)
            {
                return(null);
            }

            if (channelsList == null || channelsList.Count > 1)
            {
                throw new System.Exception("more than one publish channel cannot exist");
            }

            Channel publishChannel = channelsList[0];

            urakawa.property.channel.ChannelsProperty mediaProperty = node.GetProperty <ChannelsProperty>();

            if (mediaProperty == null)
            {
                return(null);
            }

            return((ExternalAudioMedia)mediaProperty.GetMedia(publishChannel));
        }
Example #2
0
        /// <summary>
        /// Pre-visit action: If <see cref="Media"/> is present in <see cref="Channel"/> <see cref="ChannelToClear"/>,
        /// this is removed and the child <see cref="TreeNode"/>s are not visited
        /// </summary>
        /// <param name="node">The <see cref="TreeNode"/> to visit</param>
        /// <returns>
        /// <c>false</c> if <see cref="Media"/> is found if <see cref="Channel"/> <see cref="ChannelToClear"/>,
        /// <c>false</c> else
        /// </returns>
        public bool PreVisit(TreeNode node)
        {
            ChannelsProperty chProp = node.GetChannelsProperty();

            if (chProp != null)
            {
                urakawa.media.Media m = null;

                //try
                //{
                m = chProp.GetMedia(ChannelToClear);
//                }
//                catch (ChannelDoesNotExistException ex)
//                {
//#if DEBUG
//                    Debugger.Break();
//#endif
//                    return false;
//                }

                if (m != null)
                {
                    chProp.SetMedia(ChannelToClear, null);
                }
            }

            return(true);
        }
        public override bool ValueEquals(WithPresentation other)
        {
            if (!base.ValueEquals(other))
            {
                return(false);
            }

            ChannelsProperty otherz = other as ChannelsProperty;

            if (otherz == null)
            {
                return(false);
            }

            IList <Channel> chs      = new List <Channel>(UsedChannels);
            IList <Channel> otherChs = new List <Channel>(otherz.UsedChannels);

            if (chs.Count != otherChs.Count)
            {
                //System.Diagnostics.Debug.Fail("! ValueEquals !");
                return(false);
            }
            foreach (Channel ch in chs)
            {
                Channel otherCh = null;
                foreach (Channel ch2 in otherChs)
                {
                    if (ch.Uid == ch2.Uid)
                    {
                        otherCh = ch2;
                        break;
                    }
                }
                if (otherCh == null)
                {
                    //System.Diagnostics.Debug.Fail("! ValueEquals !");
                    return(false);
                }
                if (!GetMedia(ch).ValueEquals(otherz.GetMedia(otherCh)))
                {
                    //System.Diagnostics.Debug.Fail("! ValueEquals !");
                    return(false);
                }
            }
            return(true);
        }