Beispiel #1
0
        public KalturaPlaylist Add(KalturaPlaylist playlist, bool updateStats)
        {
            KalturaParams kparams = new KalturaParams();

            if (playlist != null)
            {
                kparams.Add("playlist", playlist.ToParams());
            }
            kparams.AddBoolIfNotNull("updateStats", updateStats);
            _Client.QueueServiceCall("playlist", "add", kparams);
            if (this._Client.IsMultiRequest)
            {
                return(null);
            }
            XmlElement result = _Client.DoQueue();

            return((KalturaPlaylist)KalturaObjectFactory.Create(result));
        }
Beispiel #2
0
        public KalturaPlaylist Clone(string id, KalturaPlaylist newPlaylist)
        {
            KalturaParams kparams = new KalturaParams();

            kparams.AddStringIfNotNull("id", id);
            if (newPlaylist != null)
            {
                kparams.Add("newPlaylist", newPlaylist.ToParams());
            }
            _Client.QueueServiceCall("playlist", "clone", kparams);
            if (this._Client.IsMultiRequest)
            {
                return(null);
            }
            XmlElement result = _Client.DoQueue();

            return((KalturaPlaylist)KalturaObjectFactory.Create(result));
        }
Beispiel #3
0
 public KalturaPlaylist Update(string id, KalturaPlaylist playlist)
 {
     return(this.Update(id, playlist, false));
 }
Beispiel #4
0
 public KalturaPlaylist Add(KalturaPlaylist playlist)
 {
     return(this.Add(playlist, false));
 }
Beispiel #5
0
        static void PlaylistExecuteMultiRequestExample()
        {
            KalturaClient client = new KalturaClient(GetConfig());

            client.StartMultiRequest();

            // Request 1
            client.SessionService.Start(ADMIN_SECRET, "", KalturaSessionType.ADMIN, PARTNER_ID, 86400, "");
            client.KS = "{1:result}"; // for the current multi request, the result of the first call will be used as the ks for next calls

            // Request 2
            client.MediaService.List();

            KalturaMultiResponse response = client.DoMultiRequest();

            foreach (object obj in response)
            {
                if (obj.GetType() == typeof(KalturaAPIException))
                {
                    Console.WriteLine("Error occurred: " + ((KalturaAPIException)obj).Message);
                }
            }

            String twoEntries = "";

            if (response[1].GetType() == typeof(KalturaMediaListResponse))
            {
                KalturaMediaListResponse mediaListResponse = (KalturaMediaListResponse)response[1];
                twoEntries = mediaListResponse.Objects[0].Id + ", " + mediaListResponse.Objects[1].Id;
                Console.WriteLine("We will use the first 2 entries we got as a reponse: " + twoEntries);
            }

            if (twoEntries.Equals(""))
            {
                return;
            }

            string ks = client.GenerateSession(ADMIN_SECRET, USER_ID, KalturaSessionType.ADMIN, PARTNER_ID, 86400, "");

            client.KS = ks;

            KalturaPlaylist newPlaylist = new KalturaPlaylist();

            newPlaylist.Name            = "Test Playlist";
            newPlaylist.PlaylistContent = twoEntries;
            newPlaylist.PlaylistType    = KalturaPlaylistType.STATIC_LIST;

            KalturaPlaylist kPlaylist = client.PlaylistService.Add(newPlaylist);

            // new multirequest
            client.StartMultiRequest();

            client.PlaylistService.Execute(kPlaylist.Id);
            client.PlaylistService.Execute(kPlaylist.Id);

            response = client.DoMultiRequest();

            foreach (object obj in response)
            {
                if (obj.GetType() == typeof(KalturaAPIException))
                {
                    Console.WriteLine("Error occurred: " + ((KalturaAPIException)obj).Message);
                }
            }

            foreach (var currentResponse in response)
            {
                if (currentResponse.GetType() != typeof(KalturaMultiResponse))
                {
                    throw new Exception("Unexpected multirequest response");
                }
            }
        }