{"id":4345,"date":"2021-11-17T20:14:58","date_gmt":"2021-11-17T12:14:58","guid":{"rendered":"https:\/\/www.enablex.io\/developer\/?page_id=4345"},"modified":"2025-02-21T18:16:14","modified_gmt":"2025-02-21T10:16:14","slug":"file-share","status":"publish","type":"page","link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/video-api\/client-api\/ios-toolkit\/file-share\/","title":{"rendered":"File Sharing: iOS SDK &#8211; Video API"},"content":{"rendered":"\n<p><strong>Availability<\/strong>: <em>iOS SDK v1.5.3+  <\/em><\/p>\n\n\n\n<p><strong>Compatibility<\/strong>: <em>iOS 13+<\/em><\/p>\n\n\n\n<p>The following APIs allow users in an RTC session to send and receive file(s) with each other. Using these APIs, you can initiate a file transfer, cancel a file transfer, be notified of the availability of a file for download, and receive\/download a shared file.<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4>Table of Contents<\/h4>\n\n\n\n<ul><li><a href=\"#upload-file\">Upload file to share<\/a><\/li><li><a href=\"#download-file\">Download file<\/a><\/li><li><a href=\"#cancel-upload\">Cancel File Upload<\/a><\/li><li><a href=\"#cancel-download-file\">Cancel File Download<\/a><\/li><\/ul>\n\n\n\n<a name=\"upload-file\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Upload File to share<\/h3>\n\n\n\n<p>The <code>EnxRoom.sendFiles()<\/code> method is used to initiate a file transfer to Video Server.<\/p>\n\n\n\n<p><strong>Class:<\/strong><code> EnxRoom <\/code><\/p>\n\n\n\n<p><strong>Method:<\/strong> <code>-(void) shareFiles:(EnxFilePosition)position isBroadcast:(BOOL)isBroadcast clientIds:(NSArray *_Nullable)clientIds <\/code><\/p>\n\n\n\n<p><strong>Parameters<\/strong>:<\/p>\n\n\n\n<ul><li><code>position<\/code> \u2013 EnxFilePosition. Enumerated values: Top, Bottom, Center. Placement of File Selection UI.<\/li><li><code>isBroadcast<\/code> \u2013  Boolean. Set it to <em>true<\/em> to share file(s) with all the participants in the Session and <em>false<\/em> to share file(s) with the intended user(s). <\/li><li><code>clientIds<\/code> \u2013 List of Client IDs intended to receive the file(s). This parameter is not applicable if <code>isBroadcast<\/code> parameter is set to <em>true<\/em>.<\/li><\/ul>\n\n\n\n<p><strong>Delegate Methods at Sender End:<\/strong><\/p>\n\n\n\n<ul><li><code>-room:didInitFileUpload: <\/code>\u2013 Notification to the sender when the file upload process is initiated.<\/li><li><code>-room:didFileUploaded: <\/code>\u2013 Notification to the sender when the file has been uploaded.<\/li><li><code>-room:didFileUploadFailed: <\/code>\u2013 Notification to the sender when the file upload process fails.<\/li><\/ul>\n\n\n\n<p><strong>Delegate Methods at Receiver End:<\/strong>  <\/p>\n\n\n\n<ul><li> <code>-room:didFileUploadStarted:<\/code> \u2013 Notification to the intended receiver when a file is being uploaded.<\/li><li> <code>-room:didFileAvailable: <\/code>\u2013 Notification to the intended receiver when a file is ready to download.<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">[room shareFiles:Top isBroadcast:true clientIds:nil];\n\n\/\/ To intended receiver - A new file upload started\n- (void)room:(EnxRoom *_Nonnull)room didFileUploadStarted:(NSArray *_Nullable)data {\n    \/\/ data contains incoming file information\n}\n\n\/\/ To intended receiver - A file is available for download \n-(void)room:(EnxRoom *_Nonnull)room didFileAvailable:(NSArray *_Nullable)data {\n    \/\/ data contains incoming file information\n}\n\n\/\/ To sender - File upload process started\n- (void)room:(EnxRoom *_Nonnull)room didInitFileUpload:(NSArray *_Nullable)data {\n    \/\/ data contains file information\n}\n\n\/\/ To sender - File upload is complete\n- (void)room:(EnxRoom *_Nonnull)room didFileUploaded:(NSArray *_Nullable)data {\n\t\/\/ data contains file information\n}\n\n\/\/ To sender - File upload has failed\n- (void)room:(EnxRoom *_Nonnull)room didFileUploadFailed:(NSArray *_Nullable)data {\n\t\/\/ data contains error information\n}<\/pre>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<a name=\"download-file\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Download shared File<\/h3>\n\n\n\n<p>The process of downloading shared file(s) comprises two steps:<\/p>\n\n\n\n<ul><li>Know file(s) available for download.<\/li><li>Initiate download on the available file(s).<\/li><\/ul>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4>Know files available for download<\/h4>\n\n\n\n<p><strong>Room Lookup: <\/strong> The<strong> <code>EnxRoom.getAvailableFiles()<\/code> <\/strong>method returns a JSON Object with all the files available for download.<\/p>\n\n\n\n<p><strong>Class:<\/strong> EnxRoom<\/p>\n\n\n\n<p><strong>Method: <\/strong><code>-(NSArray*)getAvailableFiles<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[room getAvailableFiles];<\/pre>\n\n\n\n<p><strong>Delegate method<\/strong> <code>-room:didFileAvailable:<\/code> The intended receiver is notified when a file is available for download.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/\/ To intended receiver - A file is available for download \n-(void)room:(EnxRoom *_Nonnull)room didFileAvailable:(NSArray *_Nullable)data {\n    \/\/ data contains incoming file information\n}<\/pre>\n\n\n\n<h4>Initiate File Download <\/h4>\n\n\n\n<p>The <code>EnxRoom.downloadFile()<\/code> method is used to initiate the file download using the file information received above.<\/p>\n\n\n\n<p><strong>Class:<\/strong> <code>EnxRoom<\/code><\/p>\n\n\n\n<p><strong>Method<\/strong>: <code>-(void)downloadFile:(NSDictionary *_Nonnull)file autoSave:(BOOL)flag<\/code><\/p>\n\n\n\n<p><strong>Parameters<\/strong>:<\/p>\n\n\n\n<ul><li><code>file<\/code>\u2013 File Object to be downloaded.<\/li><li><code>autoSave<\/code>  \u2013 BOOL. Set it to <em>true<\/em> to save the file automatically in which case you receive the saved file&#8217;s path. When set to <em>false<\/em>, you receive Base64 encoded RAW data to handle the file saving process manually.<\/li><\/ul>\n\n\n\n<p><strong>Note:<\/strong>  Auto Saving option is applicable for Images and Video files only. The other file types need to be saved manually using Base64 encoded RAW data.<\/p>\n\n\n\n<p><strong>Callbacks at Receiver End:<\/strong><\/p>\n\n\n\n<ul><li><code>-room:didFileDownloaded<\/code>: \u2013 Notification sent when the file has been downloaded with or without auto-saving.<\/li><li><code>-room:didFileDownloadFailed:<\/code> \u2013 Notification sent when download fails.<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">[room downloadFile:fileObject autoSave:true];\n\n\/\/ To receiver - File has been downloaded\n- (void)room:(EnxRoom *_Nonnull)room didFileDownloaded:(NSString *_Nullable)data {\n\t\/\/ Handle FileObject with download information\n}\n\n\/\/ To receiver - File download has failed\n- (void)room:(EnxRoom *_Nonnull)room didFileDownloadFailed:(NSArray *_Nullable)data {\n \/\/ Handle download error\n}<\/pre>\n\n\n\n<a name=\"cancel-upload\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Cancel File Upload<\/h3>\n\n\n\n<p>The <code>EnxRoom.cancelUpload()<\/code> method allows you to cancel an ongoing file upload job initiated by you.<\/p>\n\n\n\n<p><strong>Class:<\/strong> <code>EnxRoom<\/code><\/p>\n\n\n\n<p><strong>Method:<\/strong> <code>-(void)cancelUpload:(int)jobID<\/code><\/p>\n\n\n\n<p><strong>Parameter:<\/strong><\/p>\n\n\n\n<p><code>jobId<\/code> &#8211; Numeric. The Id of the file upload job. <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&nbsp;[EnxRoom cancelUpload jobId];<\/pre>\n\n\n\n<p>The <code>EnxRoom.cancelAllUploads()<\/code> method allows you to cancel all ongoing file uploads initiated by you.<\/p>\n\n\n\n<p><strong>Method<\/strong>: <code>-(void)cancelAllUploads<\/code> &#8211; No Parameter required. <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[EnxRoom&nbsp;cancelAllUploads];<\/pre>\n\n\n\n<p><strong>Callback: <\/strong><\/p>\n\n\n\n<p><code>didFileUploadCancelled:<\/code> &#8211; Acknowledgment to the user when the file upload is canceled. <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">- (<strong>void<\/strong>)room:(EnxRoom *<strong>_Nonnull<\/strong>)room\ndidFileUploadCancelled:(NSArray&nbsp;*<strong>_Nullable<\/strong>)data<\/pre>\n\n\n\n<p><strong><strong>Error Codes \/ Exceptions<\/strong>:<\/strong> <\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Code<\/strong><\/td><td><strong>Description<\/strong><\/td><\/tr><tr><td>5089<\/td><td>Storage Access denied.<\/td><\/tr><tr><td>5090<\/td><td>Failed to save file.<\/td><\/tr><tr><td>5091<\/td><td>File-Sharing not available in this context.<\/td><\/tr><tr><td>5092<\/td><td>Too many files to upload. Max 1 file allowed per request.<\/td><\/tr><tr><td>1185<\/td><td>File size exceeds the max allowed size.<\/td><\/tr><tr><td>1182<\/td><td>Failed to upload file.<\/td><\/tr><tr><td>5098<\/td><td>Unable to cancel file upload after file upload complete.<\/td><\/tr><tr><td>5099<\/td><td>Failed to cancel upload as invalid Upload ID passed as a parameter.<\/td><\/tr><tr><td>5100<\/td><td>Failed to upload a possibly corrupt file.<\/td><\/tr><tr><td>5102<\/td><td>Cancel upload not available without Web View. Non-Contextual Method Call.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<a name=\"cancel-download-file\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Cancel File Download<\/h3>\n\n\n\n<p>The <code>EnxRoom.cancelDownload()<\/code> allows you to cancel the ongoing file download job taking place at your endpoint. <\/p>\n\n\n\n<p><strong>Class:<\/strong> EnxRoom<\/p>\n\n\n\n<p><strong>Method:<\/strong> <code>-(void)cancelDownload:(int)jobID;<\/code><\/p>\n\n\n\n<p><strong>Parameter:<\/strong><\/p>\n\n\n\n<p><code>jobId<\/code> &#8211; Numeric. The Id of the file download job.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[EnxRoom&nbsp;cancelDownload:jobId];<\/pre>\n\n\n\n<p>The <code>EnxRoom.cancelAllDownloads()<\/code> method allows you to cancel all ongoing file downloads taking place at your endpoint.<\/p>\n\n\n\n<p><strong>Method:<\/strong> <code>-(void)cancelAllDownloads<\/code> &#8211; No Parameter required.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[EnxRoom&nbsp;cancelAllDownloads];<\/pre>\n\n\n\n<p><strong>Callback:<\/strong><\/p>\n\n\n\n<p><code>didFileDownloadCancelled:<\/code> &#8211; Acknowledgment to the user when the file download is canceled.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">- (<strong>void<\/strong>)room:(EnxRoom *<strong>_Nonnull<\/strong>)room\ndidFileDownloadCancelled:(NSArray&nbsp;*<strong>_Nullable<\/strong>)data;<\/pre>\n\n\n\n<p><strong><strong>Error Codes \/ Exceptions<\/strong>:<\/strong> <\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Code<\/strong><\/td><td><strong>Description<\/strong><\/td><\/tr><tr><td>5089<\/td><td>Storage Access denied.<\/td><\/tr><tr><td>5090<\/td><td>Failed to save file.<\/td><\/tr><tr><td>1183<\/td><td>Failed to download file.<\/td><\/tr><tr><td>1181<\/td><td>File Download not available in this context<\/td><\/tr><tr><td>5101<\/td><td>File already downloaded.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n\n\n\n<div class=\"wp-block-columns\">\n<div class=\"wp-block-column\">\n<p>\u2190 <a href=\"..\/custom-signalling\/\">Custom Signalling<\/a><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column\">\n<p class=\"has-text-align-center\"><a href=\"..\/\">Index<\/a><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column\">\n<p class=\"has-text-align-right\"><a href=\"..\/screen-share\/\">Screen Share<\/a> \u2192<a href=\"\/developer\/how-to-use\/\"><\/a><\/p>\n<\/div>\n<\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Availability: iOS SDK v1.5.3+ Compatibility: iOS 13+ The following APIs allow users in an RTC session to send and receive file(s) with each other. Using these APIs, you can initiate a file transfer, cancel a file transfer, be notified of the availability of a file for download, and receive\/download a shared file. Table of Contents Upload file to share Download file Cancel File Upload Cancel File Download Upload File to&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3732,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"ub_ctt_via":""},"featured_image_src":null,"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"featured":false,"featured-large":false},"uagb_author_info":{"display_name":"vcxdevwpadmin","author_link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/author\/vcxdevwpadmin\/"},"uagb_comment_info":0,"uagb_excerpt":"Availability: iOS SDK v1.5.3+ Compatibility: iOS 13+ The following APIs allow users in an RTC session to send and receive file(s) with each other. Using these APIs, you can initiate a file transfer, cancel a file transfer, be notified of the availability of a file for download, and receive\/download a shared file. Table of Contents&hellip;","_links":{"self":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4345"}],"collection":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/comments?post=4345"}],"version-history":[{"count":0,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4345\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/3732"}],"wp:attachment":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/media?parent=4345"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}