コード例 #1
0
        public override void ProcessMP4Clip(NSUrl mp4ClipURL, NSDictionary <NSString, NSObject> setupInfo, bool finished)
        {
            // Get the endpoint URL supplied by the UI extension in the service info dictionary
            var endpointURL = new NSUrl((NSString)setupInfo["endpointURL"]);

            // Set up the request
            var request = new NSMutableUrlRequest(endpointURL)
            {
                HttpMethod = "POST"
            };

            // Upload the movie file with an upload task
            var session    = NSUrlSession.SharedSession;
            var uploadTask = session.CreateUploadTask(request, mp4ClipURL, (data, response, error) =>
            {
                if (error != null)
                {
                    // Handle the error locally
                }

                // Update broadcast settings
                var broadcastConfiguration = new RPBroadcastConfiguration
                {
                    ClipDuration = 5
                };

                // Tell ReplayKit that processing is complete for thie clip
                FinishedProcessingMP4Clip(broadcastConfiguration, null);
            });

            uploadTask.Resume();
        }
コード例 #2
0
        public void UserDidFinishSetup()
        {
            // Broadcast url that will be returned to the application
            var broadcastURL = NSUrl.FromString("http://broadcastURL_example/stream1");

            // Service specific broadcast data example which will be supplied to the process extension during broadcast
            var keys      = new[] { "userID", "endpointURL" };
            var objects   = new[] { "user1", "http://broadcastURL_example/stream1/upload" };
            var setupInfo = NSDictionary.FromObjectsAndKeys(objects, keys);

            // Set broadcast settings
            var broadcastConfig = new RPBroadcastConfiguration
            {
                ClipDuration = 5.0 // deliver movie clips every 5 seconds
            };

            // Tell ReplayKit that the extension is finished setting up and can begin broadcasting
            ExtensionContext.CompleteRequest(broadcastURL, broadcastConfig, (NSDictionary <NSString, INSCoding>)setupInfo);
        }