Skip to main content
social.plus provides comprehensive audio file management with support for multiple formats, automatic metadata extraction, and optimized storage. Upload music, podcasts, voice recordings, and other audio content with real-time progress tracking.
Audio Limits: Maximum file size is 1GB and maximum duration is 1 hour. Files exceeding these limits will be rejected during upload.

Key Features

Multiple Formats

Support for MP3, WAV, AAC, M4A, OGG, Opus, FLAC, and more

Metadata Extraction

Automatic extraction of duration, bitrate, sample rate, and channels

Progress Tracking

Real-time upload progress

Size & Duration Validation

Automatic validation against network-configured limits

Supported Audio Formats

FormatExtensionMIME TypeNotes
MP3.mp3audio/mpegMost widely supported
AAC.aac, .m4aaudio/aac, audio/mp4High quality, efficient compression
WAV.wavaudio/wavUncompressed, high quality
OGG.oggaudio/oggOpen-source alternative
FormatExtensionMIME TypeNotes
Opus.opusaudio/opusLow-latency, high quality
FLAC.flacaudio/flacLossless compression
M4A.m4aaudio/mp4Apple ecosystem standard

Audio Properties

Audio files include comprehensive metadata extracted during upload:
PropertyTypeDescription
fileIdstringUnique identifier for the audio file
fileUrlstringDirect download/streaming URL
filenamestringOriginal filename with extension
typestringAlways "audio" for audio files
PropertyTypeDescription
durationnumberAudio duration in seconds
bitRatenumberBitrate in bits per second
sampleRatenumberSample rate in Hz (e.g., 44100)
channelsnumberNumber of audio channels (1 = mono, 2 = stereo)
PropertyTypeDescription
sizenumberFile size in bytes
mimeTypestringMIME type (e.g., "audio/mpeg")
extensionstringFile extension (e.g., "mp3")
namestringFile name

Audio Metadata Structure

The System automatically extracts audio metadata once uploaded, providing detailed information for playback and display:
{
  "fileId": "68cbb5e6843c17588d5240da",
  "type": "audio",
  "fileUrl": "https://api.example.com/api/v3/files/68cbb5e6843c17588d5240da/download",
  "attributes": {
    "name": "podcast_episode_01.mp3",
    "extension": "mp3",
    "size": 1059386,
    "mimeType": "audio/mpeg",
    "metadata": {
      "sample_rate": 44100,
      "duration": 58.018,
      "bit_rate": 146003,
      "channels": 2
    }
  }
}

Audio Upload

Upload audio files with automatic validation, metadata extraction, and progress tracking. The SDK handles format verification and enforces network-configured size and duration limits.
1

Select Audio File

Choose an audio file from the device’s file system
2

Upload with Progress

Upload the file with real-time progress tracking
3

Receive Audio Data

Get the uploaded audio data with extracted metadata
4

Use in Posts

Use the fileId to create audio posts
func uploadAudioExample(audioUrl: URL) async {
    do {
        let audioData = try await fileRepository.uploadAudio(
            with: audioUrl,
            progress: { progress in
                print("Upload progress: \(progress * 100)%")
            }
        )      
        print("Upload successful!")
        print("File ID: \(audioData.fileId)")
        
        // Use audioData.fileId to create an audio post
    } catch {
        // Handle upload errors
        if let error = error as? AmityError {
            
        }
    }
}

Validation & Limits

Maximum File Size: 1GBFiles exceeding 1GB are rejected before upload begins. This validation happens client-side to prevent unnecessary network usage.
// Example: Pre-upload validation
if (audioFile.size > 1024 * 1024 * 1024) { // 1GB in bytes
  console.error('File size exceeds 1GB limit');
  return;
}
Maximum Duration: 1 Hour (3600 seconds)Audio files longer than 1 hour are rejected during server-side validation after metadata extraction.
Duration validation happens server-side, so the upload may begin before rejection occurs. Consider implementing client-side duration checks when possible.
Supported MIME TypesThe following MIME types are supported by default:
  • audio/mpeg (MP3)
  • audio/wav (WAV)
  • audio/aac (AAC)
  • audio/mp4 (M4A, MP4 audio)
  • audio/ogg (OGG)
  • audio/opus (Opus)
  • audio/flac (FLAC)
Network administrators can configure a custom allowlist of MIME types in the social.plus console. Check your network settings for specific restrictions.

Best Practices

  • Use appropriate bitrates: 128-192 kbps for speech, 256-320 kbps for music
  • Choose efficient formats: AAC or Opus for better compression than MP3
  • Normalize audio levels: Ensure consistent volume across files
  • Consider mono for speech: Reduces file size for podcasts and voice recordings
// Recommended settings for different use cases
const audioSettings = {
  podcast: { format: 'mp3', bitrate: 128, channels: 1 }, // mono
  music: { format: 'aac', bitrate: 256, channels: 2 },   // stereo
  voiceNote: { format: 'opus', bitrate: 64, channels: 1 } // mono, low bitrate
};
  • Show upload progress: Display real-time progress to keep users informed
  • Validate before upload: Check file size and format client-side
  • Provide audio preview: Let users preview before uploading
  • Handle errors gracefully: Show clear error messages with suggested actions
  • Support cancellation: Allow users to cancel long uploads
// Example: Upload with user feedback
const uploadWithFeedback = async (audioFile: File) => {
  setUploading(true);
  setProgress(0);
  
  try {
    const result = await uploadAudio(audioFile, {
      onProgress: (percent) => setProgress(percent)
    });
    showSuccess('Audio uploaded successfully!');
    return result;
  } catch (error) {
    showError(getErrorMessage(error));
  } finally {
    setUploading(false);
  }
};
  • Compress before upload: Reduce file size for faster uploads
  • Use background uploads: Don’t block UI during upload
  • Implement retry logic: Handle network failures gracefully
  • Cache uploaded files: Avoid re-uploading the same file
  • Validate early: Check constraints before starting upload
// Example: Retry logic with exponential backoff
async function uploadWithRetry(audioFile: File, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    try {
      return await uploadAudio(audioFile);
    } catch (error) {
      if (i === maxRetries - 1) throw error;
      await delay(Math.pow(2, i) * 1000); // Exponential backoff
    }
  }
}

Troubleshooting

Problem: Audio upload fails or times outCommon Causes & Solutions:
  1. File Size Exceeded
    • Error: File size exceeds 1GB limit
    • Solution: Compress audio or reduce bitrate/sample rate
  2. Duration Exceeded
    • Error: Audio duration exceeds 1 hour
    • Solution: Split long audio into multiple files or trim content
  3. Unsupported Format
    • Error: Audio format not supported
    • Solution: Convert to a supported format (MP3, AAC, WAV, etc.)
  4. Network Timeout
    • Error: Request timeout or network error
    • Solution: Implement retry logic, check internet connection
// Example: Error handling with specific actions
try {
  await uploadAudio(file);
} catch (error) {
  switch (error.code) {
    case 'FILE_SIZE_EXCEEDED':
      return compressAndRetry(file);
    case 'DURATION_EXCEEDED':
      return suggestSplitting(file);
    case 'UNSUPPORTED_FORMAT':
      return suggestConversion(file);
    case 'NETWORK_ERROR':
      return retryWithBackoff(file);
    default:
      return showGenericError(error);
  }
}
Problem: Missing or incorrect metadataSolutions:
  • Ensure audio file has valid metadata embedded
  • Use standard audio formats (MP3, AAC) for better metadata support
  • Re-encode file with proper metadata if needed
// Check metadata after upload
if (!audioData.attributes?.metadata?.duration) {
  console.warn('Duration metadata missing - may need to re-encode');
}
Problem: Uploaded audio won’t play or has quality issuesSolutions:
  • Verify format is supported by target platform browsers/players
  • Check bitrate isn’t too low (min 64 kbps recommended)
  • Ensure sample rate is standard (44.1kHz or 48kHz)
  • Test playback URL directly in browser
// Validate audio quality settings
const isQualityAcceptable = (metadata: AudioMetadata) => {
  return metadata.bit_rate >= 64000 && // At least 64 kbps
         [44100, 48000].includes(metadata.sample_rate); // Standard sample rates
};

Common Use Cases

Podcasts

Upload podcast episodes with chapter markers and metadata

Music Sharing

Share songs, albums, or playlists with high-quality audio

Voice Messages

Quick voice recordings for personal communication

Audio Books

Share narrated content and audiobook chapters

Sound Effects

Upload audio samples and sound effects libraries

Interviews

Record and share interview recordings and discussions