Closed skjo0c closed 5 years ago
I am trying to use upchunk to upload video in mux with direct uploads, but shows following error: TypeError: Cannot read property 'createUpload' of undefined. I am trying to upload with react-dropzone and following is a part of my code:
TypeError: Cannot read property 'createUpload' of undefined
import UpChunk from '@mux/upchunk' <Dropzone className={classes.dropzone} maxSize={MAX_SIZE} accept="video/*" onDrop={this.uploadHandler} >...</Dropzone> uploadHandler = (accepted) => { accepted.forEach((file) => { // console.log(file) const getUploadUrl = () => { fetch('/video-upload').then((res) => res.ok ? res.text() : console.log(new Error('Error getting an upload URL :(')), ) } console.log(getUploadUrl, 'getUploadUrl') const upload = UpChunk.createUpload({ endpoint: '/video-upload', file, chunkSize: 5120, // Uploads the file in ~5mb chunks }) // subscribe to events upload.on('error', (err) => { console.error('💥 🙀', err.detail) }) upload.on('progress', (progress) => { console.log(`So far we've uploaded ${progress.detail}% of this file.`) }) upload.on('success', () => { console.log("Wrap it up, we're done here. 👋") }) }) }
Gah this question was answered in a different conversation and I forgot to follow up here.
I'll update the documentation, but this should be import * as UpChunk from '@mux/upchunk';.
import * as UpChunk from '@mux/upchunk';
I am trying to use upchunk to upload video in mux with direct uploads, but shows following error:
TypeError: Cannot read property 'createUpload' of undefined
. I am trying to upload with react-dropzone and following is a part of my code: