Skip to content

yaamwebsolutions/tchomb-upload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@tchomb/upload

Upload state machine and transport adapters for Tchomb video uploads.

Installation

npm install @tchomb/upload

Usage

Transport (low-level)

import { createUploader } from '@tchomb/upload';

const uploader = createUploader({
  baseUrl: 'https://api.tchomb.com',
  getAuthHeaders: async () => ({
    Authorization: `Bearer ${token}`,
  }),
});

const result = await uploader.upload(fileUri, {
  caption: 'Ma nouvelle vidéo',
  hashtags: ['cameroun', 'musique'],
  language: 'fr',
  onProgress: (pct) => console.log(`${pct}%`),
});

React Hook

import { useUpload } from '@tchomb/upload';

function UploadScreen() {
  const { state, progress, error, videoId, start } = useUpload(uploadFn);

  return (
    <Button onPress={() => start(fileUri, metadata)}>
      {state === 'uploading' ? `${progress}%` : 'Publier'}
    </Button>
  );
}

States

idleuploadingdone | error

Part of Tchomb

Package Description
@tchomb/shared-types Shared TypeScript types
@tchomb/ui Design system
@tchomb/api-client Typed HTTP client
@tchomb/upload Upload state machine
@tchomb/player Vertical video player

License

MIT

About

Upload state machine and transport adapters for Tchomb video uploads

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors