Skip to content

Commit

Permalink
fix: make meta field publicly queryable
Browse files Browse the repository at this point in the history
  • Loading branch information
pranvinit committed Nov 19, 2024
1 parent 1db432e commit 3ca7e25
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 71,965 deletions.
27 changes: 23 additions & 4 deletions admin/rt-transcoder-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,15 @@ function add_transcoded_url_field( $form_fields, $post ) {
$form_fields['transcoded_url'] = array(
'label' => __( 'Transcoded MPD URL', 'transcoder' ),
'input' => 'html',
'html' => '<input type="text" name="attachments[' . $post->ID . '][transcoded_url]" id="attachments-' . $post->ID . '-transcoded_url" value="' . esc_url( $transcoded_url ) . '" ' . disabled( ! $adaptive_bitrate_enabled, true, false ) . ' />',
'html' => '<input type="text" name="attachments[' . $post->ID . '][transcoded_url]" id="attachments-' . $post->ID . '-transcoded_url" value="' . esc_url( $transcoded_url ) . '" ' . disabled( false ) . ' />',
'value' => esc_url( $transcoded_url ),
'helps' => __( 'Enter or edit the URL of the transcoded .mpd file stored on Amazon S3.', 'transcoder' ),
);

// Add a note if adaptive bitrate streaming is disabled.
if ( ! $adaptive_bitrate_enabled ) {
$form_fields['transcoded_url']['helps'] = __( 'This feature is available only when adaptive bitrate streaming is enabled.', 'transcoder' );
}
// if ( ! $adaptive_bitrate_enabled ) {
// $form_fields['transcoded_url']['helps'] = __( 'This feature is available only when adaptive bitrate streaming is enabled.', 'transcoder' );
// }

return $form_fields;
}
Expand Down Expand Up @@ -291,3 +291,22 @@ function save_transcoded_url_field( $post, $attachment ) {
}

add_filter( 'attachment_fields_to_save', 'save_transcoded_url_field', 10, 2 );

/**
* Register the transcoded URL meta field.
*/
function register_rt_transcoded_url_meta() {
register_post_meta(
'attachment',
'_rt_transcoded_url',
array(
'type' => 'string',
'single' => true,
'show_in_rest' => true,
'auth_callback' => function () {
return current_user_can( 'edit_posts' );
},
)
);
}
add_action( 'init', 'register_rt_transcoded_url_meta' );
2 changes: 1 addition & 1 deletion assets/build/blocks/rt-player/frontend.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '9a42bf9ab6cdcc318598');
<?php return array('dependencies' => array(), 'version' => 'a5d985503618977131be');
31 changes: 1 addition & 30 deletions assets/build/blocks/rt-player/frontend.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 1 addition & 22 deletions assets/build/blocks/rt-player/index-rtl.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/*!*********************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[2].use[2]!./node_modules/video.js/dist/video-js.css ***!
\*********************************************************************************************************************************************************************************************/
.vjs-svg-icon {
display: inline-block;
background-repeat: no-repeat;
Expand Down Expand Up @@ -2014,24 +2011,6 @@ video::-webkit-media-text-track-display {
outline: none;
}

/*!*************************************************************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[2].use[2]!./node_modules/videojs-contrib-quality-menu/dist/videojs-contrib-quality-menu.css ***!
\*************************************************************************************************************************************************************************************************************************************/
.video-js.vjs-quality-menu{display:block}.video-js.vjs-quality-menu .vjs-quality-menu-button{position:relative}.video-js.vjs-quality-menu .vjs-quality-menu-button li{text-transform:none}.video-js.vjs-quality-menu .vjs-quality-menu-button.vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:25em;width:10em;right:0}.video-js.vjs-quality-menu .vjs-menu-item .vjs-control-text{position:absolute}.video-js.vjs-quality-menu .vjs-quality-menu-wrapper{position:relative}.video-js.vjs-quality-menu .vjs-quality-menu-wrapper li{text-transform:none}.video-js.vjs-quality-menu .vjs-quality-menu-wrapper.vjs-menu-wrapper-popup .vjs-menu .vjs-menu-content{max-height:25em;width:10em;right:0}.video-js.vjs-quality-menu .vjs-quality-menu-item-sub-label{font-size:75%;font-weight:bold;position:absolute;left:0;text-align:center;width:4em}.video-js.vjs-quality-menu .vjs-quality-menu-button-use-resolution .vjs-quality-menu-item-sub-label{position:absolute;left:0;text-align:center;width:4em}.video-js.vjs-quality-menu .vjs-quality-menu-button-4K-flag:after,.video-js.vjs-quality-menu .vjs-quality-menu-button-HD-flag:after{background-color:#2b333f;color:inherit;content:"";font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:.7em;font-weight:300;height:2.2em;line-height:2.2em;padding:0;position:absolute;left:0;text-align:center;top:.5em;width:2.2em;border-radius:2em;letter-spacing:.1em}.video-js.vjs-quality-menu .vjs-quality-menu-button-HD-flag:after{content:"HD"}.video-js.vjs-quality-menu .vjs-quality-menu-button-4K-flag:after{content:"4K"}.video-js.vjs-quality-menu .vjs-quality-menu-button-waiting:before{animation:vjs-spinner-spin 1.1s cubic-bezier(0.6, 0.2, 0, 0.8) infinite}

/*!****************************************************************************************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./assets/src/blocks/rt-player/editor.scss ***!
\****************************************************************************************************************************************************************************************************************************************************************/
/**
* The following styles get applied inside the editor only.
*
* Replace them with your own styles or remove the file completely.
*/
.block-editor-block-inspector .components-panel__row {
margin-bottom: 1em;
}
.block-editor-block-inspector .components-panel__row .upload-controls {
display: flex;
flex-direction: column;
gap: 1em;
}
.block-editor-block-inspector .components-panel__row{margin-bottom:1em}.block-editor-block-inspector .components-panel__row .upload-controls{display:flex;flex-direction:column;gap:1em}
2 changes: 1 addition & 1 deletion assets/build/blocks/rt-player/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'e4cc6333f7212ea97e3b');
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '059228d25a0c2c3176a0');
23 changes: 1 addition & 22 deletions assets/build/blocks/rt-player/index.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3ca7e25

Please sign in to comment.