You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a YouTube type of application and having an issue uploading larger videos.
Smaller videos work great, but I am having issues with videos in the range of 100MB or more.
Here is the error message I'm getting:
Here is the code (next.js app):
// initializing bundlr in pages/_app.jsasyncfunctioninitialiseBundlr(){awaitwindow.ethereum.enable()constprovider=newproviders.Web3Provider(window.ethereum);awaitprovider._ready()constbundlr=newWebBundlr("https://node1.bundlr.network","matic",provider)awaitbundlr.ready()setBundlrInstance(bundlr)bundlrRef.current=bundlrfetchBalance()}
// main code in pages/index.jsimportBigNumberfrom'bignumber.js'import{useContext,useState}from'react'import{MainContext}from'../context'exportdefaultfunctionHome(){const[file,setFile]=useState()const[image,setImage]=useState()const[URI,setURI]=useState()const[amount,setAmount]=useState()const{ bundlrInstance, initialiseBundlr, balance, fetchBalance }=useContext(MainContext)asyncfunctioninitialize(){initialiseBundlr()}functiononFileChange(e){constfile=e.target.files[0]if(file){constimage=URL.createObjectURL(file)setImage(image)letreader=newFileReader()reader.onload=function(){if(reader.result){setFile(Buffer.from(reader.result))console.log('file set...')}}reader.readAsArrayBuffer(file)}}asyncfunctionuploadFile(){consttags=[{name: 'Content-Type',value: 'video/mp4'}];bundlrInstance.useChunking=truelettx=awaitbundlrInstance.uploader.upload(file,tags)console.log('tx: ',tx)setURI(`http://arweave.net/${tx.data.id}`)}asyncfunctionfundWallet(){if(!amount)returnconstamountParsed=parseInput(amount)letresponse=awaitbundlrInstance.fund(amountParsed)console.log('Wallet funded: ',response)fetchBalance()}functionparseInput(input){constconv=newBigNumber(input).multipliedBy(bundlrInstance.currencyConfig.base[1])if(conv.isLessThan(1)){console.log('error: value too small')return}else{returnconv}}return(<divstyle={containerStyle}>{!balance&&<buttononClick={initialize}>Initialize</button>}{balance&&(<div><h3>Balance: {balance}</h3><divstyle={{padding: '20px 0px'}}><inputonChange={e=>setAmount(e.target.value)}/><buttononClick={fundWallet}>Fund Wallet</button></div><inputtype="file"onChange={onFileChange}/><buttononClick={uploadFile}>Upload File</button>{image&&(<videowidth="320"height="240"controls><sourcesrc={image}type="video/mp4"/></video>)}{URI&&<ahref={URI}>{URI}</a>}</div>)}</div>)}constcontainerStyle={padding: '100px 20px'}
The text was updated successfully, but these errors were encountered:
I'm working on a YouTube type of application and having an issue uploading larger videos.
Smaller videos work great, but I am having issues with videos in the range of 100MB or more.
Here is the error message I'm getting:
Here is the code (next.js app):
The text was updated successfully, but these errors were encountered: