feat: add video duration-based pricing via HTML5 File API#110
Open
RensTillmann wants to merge 1 commit intomasterfrom
Open
feat: add video duration-based pricing via HTML5 File API#110RensTillmann wants to merge 1 commit intomasterfrom
RensTillmann wants to merge 1 commit intomasterfrom
Conversation
Allow calculator fields to use {fieldname;duration} syntax to sum the
total duration (in seconds) of uploaded video files before submission.
When a video file is selected, a temporary blob URL is created and loaded
into a hidden <video> element. The duration is read from the
loadedmetadata event and stored in SUPER.files, then the calculator hook
is re-triggered to update pricing in real time.
Usage example: {video_field;duration} * 5.00 prices at $5 per second.
Closes #104
Co-authored-by: Rens Tillmann <RensTillmann@users.noreply.github.com>
| var fileList = SUPER.files[uploadFormId][name]; | ||
| for (var fli = 0; fli < fileList.length; fli++) { | ||
| if (fileList[fli] && typeof fileList[fli]['duration'] !== 'undefined') { | ||
| sum += parseFloat( fileList[fli]['duration'] ); |
There was a problem hiding this comment.
['duration'] is better written in dot notation.
| typeof SUPER.files[uploadFormId][name] !== 'undefined') { | ||
| var fileList = SUPER.files[uploadFormId][name]; | ||
| for (var fli = 0; fli < fileList.length; fli++) { | ||
| if (fileList[fli] && typeof fileList[fli]['duration'] !== 'undefined') { |
There was a problem hiding this comment.
['duration'] is better written in dot notation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Allows calculator fields to use
{fieldname;duration}syntax to sum total video duration (seconds) of uploaded files before submission. Uses HTML5 File API with a hidden<video>element to read metadata without uploading.Closes #104
Target Branch
masterSuper Forms Version
Targets version: v6.4.201
User Population Affected
Type of Change
Backward Compatibility Checklist
super_*hook or filter name was renamed or removed[super_form]shortcode attribute was removed or renamedFor AI-Generated PRs
Source issue: #104
Implementation confidence: uncertain
Files modified: src/assets/js/common.js
New hooks added (if any): none
Migration required: no