{"id":4657,"date":"2021-12-02T19:31:38","date_gmt":"2021-12-02T11:31:38","guid":{"rendered":"https:\/\/www.enablex.io\/developer\/?page_id=4657"},"modified":"2025-02-22T20:32:48","modified_gmt":"2025-02-22T12:32:48","slug":"file-share","status":"publish","type":"page","link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/video-api\/client-api\/flutter-toolkit\/file-share\/","title":{"rendered":"File Sharing: Flutter SDK &#8211; Video API"},"content":{"rendered":"\n<p>File Share API allows users of a RTC session to send and receive file(s) to\/from each other. Using the available APIs, you can initiate file transfer to share, cancel a file transfer, get notified on a shared file and receive\/download shared file.<\/p>\n\n\n\n<h4>Table of Contents<\/h4>\n\n\n\n<ul><li><a href=\"#upload-file\">Upload a File to Share<\/a><\/li><li><a href=\"#cancel-upload\">Cancel a File Upload<\/a><\/li><li><a href=\"#cancel-uploads\">Cancel all Files Upload<\/a><\/li><li><a href=\"#download-file\">Download a File<\/a><\/li><li><a href=\"#cancel-download\">Cancel a File Download<\/a><\/li><li><a href=\"#cancel-all-download\">Cancel all Files 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 file sharing process starts with a user initiating a file transfer to Video Server. To initiate a file transfer use <code>sendFiles()<\/code> method. <\/p>\n\n\n\n<p><strong>Method:<\/strong> <code>static Future&lt;void&gt; sendFiles(bool isBroadCast, List&lt;dynamic&gt; recipientIDs)<\/code><\/p>\n\n\n\n<p><strong>Parameters<\/strong>:<\/p>\n\n\n\n<ul><li><code>@param bool isBroadcast<\/code> \u2013 Boolean. This is to share file among all participants  in the Session. If you need to target the file share to specific user,  then set it to false.<\/li><li><code>@param List recipientIDs<\/code>\u2013 List of Client IDs. This is to share the file among specified Clients only. If broadcast is set to true, <code>recipientIDs<\/code> is ignored.<\/li><\/ul>\n\n\n\n<p><strong>Callbacks at Sender End:<\/strong>  <\/p>\n\n\n\n<ul><li><code>onInitFileUpload<\/code> &#8211; To notify sender that file upload process is initiated<\/li><li><code>OnFileUploaded<\/code> &#8211; To notify sender that file has been uploaded<\/li><li><code>OnFileUploadFailed<\/code> &#8211; To notify sender that file upload process has failed<\/li><\/ul>\n\n\n\n<p><strong>Callbacks at Receiver End:<\/strong>  <\/p>\n\n\n\n<ul><li><code>OnFileUploadStarted<\/code> &#8211; To notify intended receiver that a file is being uploaded<\/li><li><code>OnFileAvailable<\/code> &#8211; To notify intended received that a file is ready to download<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">EnxRtc.sendFile(true,[]);\t\/\/ Send Files\n\nEnxRtc.onInitFileUpload = (Map&lt;dynamic,dynamic&gt; map) {\n\t\/\/ File upload started\n};\n\nEnxRtc.onFileUploaded = (Map&lt;dynamic,dynamic&gt; map) {\n\t\/\/ File is uploaded\n};\n\nEnxRtc.onFileUploadFailed = (Map&lt;dynamic,dynamic&gt; map) {\n\t\/\/ File upload failed\n};\n\nEnxRtc.onFileUploadStarted = (Map&lt;dynamic,dynamic&gt; map) {\n\t\/\/ File upload started... to recipient\n};\n\nEnxRtc.onFileAvailable = (Map&lt;dynamic,dynamic&gt; map) {\n\t\/\/ Files available for download... to recipient\n};<\/pre>\n\n\n\n<p><strong>Error Codes:<\/strong> Upload process may encounter error. <\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Error Code<\/strong><\/td><td><strong>Error Description<\/strong><\/td><\/tr><tr><td>5089<\/td><td>Storage Access denied<\/td><\/tr><tr><td>5091<\/td><td> File Sharing not available in this context <\/td><\/tr><tr><td>1185<\/td><td>Too large file. Max allowed Size: NNNN<\/td><\/tr><tr><td>1182<\/td><td>Failed to upload file<\/td><\/tr><\/tbody><\/table><\/figure>\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 a File Upload<\/h3>\n\n\n\n<p>Sender of a file may like to cancel an ongoing file upload. To do so use <code>cancelUpload()<\/code> method. <\/p>\n\n\n\n<p><code>Method<\/code>: <code>static Future&lt;void&gt; cancelUpload(int jobId)<\/code><\/p>\n\n\n\n<p><strong>Parameters<\/strong>:  <code>@param int jobId<\/code> &#8211; Job ID which is to be cancelled.<\/p>\n\n\n\n<p><strong>Event Listeners: <\/strong> <code>onFileUploadCancelled<\/code> \u2013 It notifies when the file upload cancelled successfully<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">EnxRtc.cancelFileUpload(jobId);\t\t\/\/ Cancel File uploading\n\nEnxRtc.onFileUploadCancelled = (Map&lt;dynamic,dynamic&gt; map) {\n\t\/\/ Upload has been cancelled\n};<\/pre>\n\n\n\n<a name=\"cancel-uploads\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Cancel all Files Upload<\/h3>\n\n\n\n<p>Sender of multiple files may like to cancel an ongoing files upload. To do so use <code>cancelAllUploads()<\/code> method. <\/p>\n\n\n\n<p><code>Method<\/code>: <code>static Future&lt;void&gt; cancelAllUploads()<\/code><\/p>\n\n\n\n<p><strong>Parameters<\/strong>:  <code>@param int jobId<\/code> &#8211; Job ID which is to be cancelled.<\/p>\n\n\n\n<p><strong>Event Listeners: <\/strong> <code>onFileUploadCancelled<\/code> \u2013 It notifies when the file upload cancelled successfully<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">EnxRtc.cancelAllUploads();\t\/\/ Cancel Files uploading\n\nEnxRtc.onFileUploadCancelled = (Map&lt;dynamic,dynamic&gt; map) {\n\t\/\/ Upload has been cancelled\n};<\/pre>\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>Intended Recipients needs to download each file shared with them \nindividually. Therefore, recipient needs to know information on the \navailable files to download to initiate a download process. <\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4>Know files to download<\/h4>\n\n\n\n<p><strong>Room Lookup: <\/strong>To know what all files are available for download, you may call  <code>EnxRoom.getAvailableFiles()<\/code> method. It returns list of File data.<\/p>\n\n\n\n<p><code>Method<\/code>: <code>static Future&lt;List&lt;dynamic&gt; getAvailableFiles()<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">List&lt;dynamic&gt; list= EnxRtc.getAvailableFiles();<\/pre>\n\n\n\n<p><strong>When New File is availble:<\/strong> A receive end point is notified as and when a file is made available for download using Event Listener <code>onFileAvailable<\/code>  <\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4>Initiate File Download <\/h4>\n\n\n\n<p>As you know about the file(s) to download, you need to initiate download individually using <code>downloadFile()<\/code> method.<\/p>\n\n\n\n<p><strong>Method<\/strong>: <code>static Future&lt;void&gt; downloadFile(Map&lt;String,dynamic&gt; file, bool autoSave)<\/code><\/p>\n\n\n\n<p><strong>Parameters<\/strong>:<\/p>\n\n\n\n<ul><li><code>@param Map fileInfo<\/code>\u2013 Map of file to be downloaded.<\/li><li><code>@param bool autosave<\/code>\u2013 Whether to save the file automatically. If not to be save automatically, you would receive Base64 encoded RAW data to handle file saving processes manually. If auto-saving is on, you would receive saved file path.<\/li><\/ul>\n\n\n\n<p><strong>Callbacks at Receiver End:<\/strong><\/p>\n\n\n\n<ul><li><code>onFileDownloaded<\/code> &#8211; To notify file has been downloaded with either Base64 Raw data to be saved (When auto-saving is false) or saved file path.<\/li><li><code>OnFileDownloadFailed<\/code> &#8211; To notify download failure<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">EnxRtc.downloadFile(fileInfo,true);\t\/\/ Download a File\n\nEnxRtc.onFileDownloaded = (Map&lt;dynamic,dynamic&gt; map) {\n\t\/\/ File has been downloaded\n};\n\nEnxRtc.onFileDownloadFailed = (Map&lt;dynamic,dynamic&gt; map) {\n\t\/\/ File Download has failed \n};<\/pre>\n\n\n\n<p><strong>Error Codes:<\/strong> Download process may encounter error.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Error Code<\/strong><\/td><td><strong>Error 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><\/tbody><\/table><\/figure>\n\n\n\n<a name=\"cancel-download\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Cancel downloading a File<\/h3>\n\n\n\n<p>Receiver of a file may like to cancel an ongoing download of a file by using <code>cancelDownload()<\/code> method. <\/p>\n\n\n\n<p><code>Method<\/code>: <code>static Future&lt;void&gt; cancelDownload(int jobId)<\/code><\/p>\n\n\n\n<p><strong>Parameters<\/strong>:  <code>@param int jobId<\/code> &#8211; Job ID which is to be cancelled.<\/p>\n\n\n\n<p><strong>Event Listeners: <\/strong> <code>onFileDownloadCancelled<\/code> \u2013 It notifies when the file download is cancelled.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">EnxRtc.cancelFileDownload(jobId);\t\/\/ Cancel a download job\n\nEnxRtc.onFileDownloadCancelled=(Map&lt;dynamic,dynamic&gt; map) {\n\t\/\/ File download has been cancelled\n};<\/pre>\n\n\n\n<a name=\"cancel-all-download\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Cancel downloading all Files<\/h3>\n\n\n\n<p>Receiver of files may like to cancel ongoing download of all files by using <code>cancelAllDownloads()<\/code> method. <\/p>\n\n\n\n<p><code>Method<\/code>: <code>static Future&lt;void&gt; cancelAllDownloads()<\/code><\/p>\n\n\n\n<p><strong>Event Listeners: <\/strong> <code>onFileDownloadCancelled<\/code> \u2013 It notifies when the file download is cancelled.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">EnxRtc.cancelAllDownloads();\t\/\/ Cancel  download job\n\nEnxRtc.onFileDownloadCancelled=(Map&lt;dynamic,dynamic&gt; map) {\n\t\/\/ File download has been cancelled\n};<\/pre>\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=\"..\/chat\/\">Send Message<\/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>File Share API allows users of a RTC session to send and receive file(s) to\/from each other. Using the available APIs, you can initiate file transfer to share, cancel a file transfer, get notified on a shared file and receive\/download shared file. Table of Contents Upload a File to Share Cancel a File Upload Cancel all Files Upload Download a File Cancel a File Download Cancel all Files Download Upload&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3755,"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":"File Share API allows users of a RTC session to send and receive file(s) to\/from each other. Using the available APIs, you can initiate file transfer to share, cancel a file transfer, get notified on a shared file and receive\/download shared file. Table of Contents Upload a File to Share Cancel a File Upload Cancel&hellip;","_links":{"self":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4657"}],"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=4657"}],"version-history":[{"count":0,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4657\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/3755"}],"wp:attachment":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/media?parent=4657"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}