-
Notifications
You must be signed in to change notification settings - Fork 21
Add audio recording support for WPForms GoDAM Recorder #1446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
c483ba4
229c54b
1677f18
ddd6445
3994acf
89828b0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| <?php | ||
| /** | ||
| * Template/View which is render on the WPForms Edit Entry page for the GoDAM Video Recorder field. | ||
|
|
@@ -30,9 +30,28 @@ | |
| wpforms_html_attributes( $godam_primary['id'], $godam_primary['class'], $godam_primary['data'], $godam_primary['attr'] ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | ||
| $godam_primary['required'] // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | ||
| ); | ||
|
|
||
| // Detect if this is an audio file. | ||
| $file_type = wp_check_filetype( $godam_value ); | ||
|
Check warning on line 35 in inc/classes/wpforms/wpforms-field-godam-record-entry-edit.php
|
||
| $mime_type = ! empty( $file_type['type'] ) ? $file_type['type'] : ''; | ||
|
Check warning on line 36 in inc/classes/wpforms/wpforms-field-godam-record-entry-edit.php
|
||
| $is_audio = ! empty( $mime_type ) && strpos( $mime_type, 'audio' ) !== false; | ||
|
Check warning on line 37 in inc/classes/wpforms/wpforms-field-godam-record-entry-edit.php
|
||
|
|
||
| if ( 'webm' === $file_type['ext'] && godam_is_audio_file_by_name( $godam_value ) ) { | ||
|
||
| $is_audio = true; | ||
|
Check warning on line 40 in inc/classes/wpforms/wpforms-field-godam-record-entry-edit.php
|
||
| } | ||
| ?> | ||
| <div class="godam-video-preview"> | ||
| <?php echo do_shortcode( "[godam_video poster='{$godam_thumbnail_url}' src='{$godam_value}' transcoded_url='{$godam_transcoded_url}']" ); ?> | ||
| <?php if ( $is_audio ) : ?> | ||
| <audio controls> | ||
| <?php if ( $godam_transcoded_url ) : ?> | ||
| <source src="<?php echo esc_url( $godam_transcoded_url ); ?>" type="audio/mpeg"> | ||
mi5t4n marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <?php endif; ?> | ||
| <source src="<?php echo esc_url( $godam_value ); ?>" type="<?php echo esc_attr( $mime_type ); ?>"> | ||
| <?php esc_html_e( 'Your browser does not support the audio element.', 'godam' ); ?> | ||
| </audio> | ||
| <?php else : ?> | ||
| <?php echo do_shortcode( "[godam_video poster='{$godam_thumbnail_url}' src='{$godam_value}' transcoded_url='{$godam_transcoded_url}']" ); ?> | ||
AhmarZaidi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <?php endif; ?> | ||
| </div> | ||
| <a | ||
| href="<?php echo esc_url( $godam_value ); ?>" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.