Skip to content

Fix audio file format for forms #1697

Open
AhmarZaidi wants to merge 3 commits intodevelopfrom
fix/1531
Open

Fix audio file format for forms #1697
AhmarZaidi wants to merge 3 commits intodevelopfrom
fix/1531

Conversation

@AhmarZaidi
Copy link
Contributor

@AhmarZaidi AhmarZaidi commented Mar 5, 2026

Issue: #1531

This PR fixes audio files recorded from form plugins being stored as video/webm instead of proper audio MIME types on GoDAM Central.

When audio files (.webm, .mp4) were uploaded via form recorders, the transcoding API was receiving job_type: "audio" but mime_type: "video/webm" which was incorrect. This was happening because wp_check_filetype() returns video/webm for container formats like .webm, .mp4 etc., that can hold both audio and video.

To fix this modified rtgodam_send_video_to_godam_for_transcoding() to set mimetype to audio/**** when job_type is "audio"

Testing Instructions

Test Case 1: Audio Recording

  1. Create a form (any supported plugin) with GoDAM Recorder field
  2. Enable "Audio" file selector in field settings
  3. Record audio in browser
  4. Submit form
  5. Verify: On GoDAM Central, file shows as audio/webm (not video/webm)

Test Case 2: Video Recording (Regression)

  1. Record video (not audio) in the same form
  2. Submit form
  3. Verify: File correctly shows as video/webm on GoDAM Central

Note: I tested with Edge, Chrome, Firefox and Safari to make sure all browser formats are working correctly.

Screenshots

image

Minor Additional Changes

Added some minor additional fixes which are not directly related to the issue #1531:

  • WPForms: On entries page audio preview was showing error when transcoding fails, fixed it by adding null check and 'audio/mpeg' to audio element's type attr instead of empty value.
  • Ninja Forms: Updated label to Start Recording instead of Record Video to match other forms (haven't updated the same for Fluent Forms in this PR because that will be done by PR #1204)

Note: Fluent Form was tested by using changes from PR #1204.

- Make job type detection DRY
- Use job_type to update file format to audio
- Add job_type to fluent forms
- Update gravity forms to use custom functions
- Update ninja forms to use custom functions
@AhmarZaidi AhmarZaidi self-assigned this Mar 5, 2026
Copilot AI review requested due to automatic review settings March 5, 2026 10:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses incorrect MIME types being sent to GoDAM Central for audio recordings submitted via supported form plugins, ensuring audio container uploads (e.g., .webm, .mp4) are treated as audio when the transcoding job_type is audio.

Changes:

  • Added a shared godam_get_job_type() helper to consistently determine job_type (audio vs stream) across form integrations.
  • Updated multiple form integrations to use the shared job type helper instead of duplicating file-type detection logic.
  • Adjusted rtgodam_send_video_to_godam_for_transcoding() to correct mime_type from video/* to audio/* when job_type is audio.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
inc/helpers/custom-functions.php Adds godam_get_job_type() and fixes MIME type mapping for audio jobs when WordPress detects a video/* container MIME.
inc/classes/wpforms/class-wpforms-integration.php Uses shared job-type detection when sending recorded files for transcoding.
inc/classes/sureforms/class-form-submit.php Uses shared job-type detection before calling transcoding helper.
inc/classes/ninja-forms/class-ninja-forms-field-godam-recorder.php Replaces custom MIME/extension logic with shared job-type detection and passes it through consistently.
inc/classes/gravity-forms/class-init.php Determines job type per-file (including multi-file) via shared helper before transcoding.
inc/classes/gravity-forms/class-gf-field-godam-video.php Simplifies audio/video detection by using godam_is_audio_file() for audio determination.
inc/classes/fluentforms/class-form-submit.php Computes and passes job_type to transcoding call (previously relied on default).
inc/classes/everest-forms/class-everest-forms-integration.php Uses shared job-type detection before sending for transcoding.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@AhmarZaidi AhmarZaidi requested a review from KMchaudhary March 5, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants