Skip to content
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

Feature/add transcoded url meta #296

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
970ef51
refactor: update dependencies and webpack configuration to modern sta…
pranvinit Nov 8, 2024
3c83e8a
feature: add rt-player block
pranvinit Nov 8, 2024
319757b
fix: add dynamic video type in save.js
pranvinit Nov 8, 2024
ec4b1dc
enhance: add post meta transcoded url as video source and fallback to…
pranvinit Nov 12, 2024
0b7ded9
feature: add meta field for transcoded URL and option to toggle it
pranvinit Nov 13, 2024
9ad669d
fix: phpcs comments
pranvinit Nov 13, 2024
59ab2b9
chore: remove build from phpcs
pranvinit Nov 13, 2024
aed778d
enhance: extend webpack config to minify admin scripts and styles
pranvinit Nov 14, 2024
58fc8eb
feature: add real-time transcoding progress to media uploads
pranvinit Nov 18, 2024
54095d7
enhance: add progress count and show progress bar for existing media
pranvinit Nov 18, 2024
1db432e
fix: empty progress bar on page load
pranvinit Nov 19, 2024
3ca7e25
fix: make meta field publicly queryable
pranvinit Nov 19, 2024
5cb6b57
fix: frontend quality selector not working
pranvinit Nov 20, 2024
9808a21
feature: add watermark settings for paid users
pranvinit Nov 20, 2024
4e03d60
feature: add support for image watermarks
pranvinit Nov 21, 2024
f4fa7f8
fix: has_access var and scripts enqueue
pranvinit Nov 22, 2024
1e1ee7b
Update the watermark checkbox UI and move the admin page under media …
Nov 25, 2024
ca062ee
Pass the ABS and watermark argument on wp_media_transcoding request
Nov 26, 2024
b5cff1e
Implement the responisve media player block called EasyDAM Player usi…
Nov 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions .babelrc

This file was deleted.

1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
**/*.build.js
**/node_modules/**
**/vendor/**
assets/**
build
node_modules
Gruntfile.js
2 changes: 1 addition & 1 deletion .github/workflows/phpcs_on_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Run PHPCS inspection
uses: rtCamp/action-phpcs-code-review@master
env:
SKIP_FOLDERS: "tests,.github"
SKIP_FOLDERS: "tests,.github,assets/build"
GH_BOT_TOKEN: ${{ secrets.RTBOT_TOKEN }}
with:
args: WordPress,WordPress-Core,WordPress-Docs
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ sftp-config.json
*.sublime-workspace
.editorconfig
.cache/
package-lock.json
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v13.1.0
v18.20.3
20 changes: 20 additions & 0 deletions admin/css/rt-progress-bar.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.transcoder-progress-bar {
position: absolute;
left: 0;
right: 0;
bottom: -10px;
height: 10px;
background: rgba(0, 0, 0, 0.1);
}
.transcoder-progress-bar .progress {
height: 100%;
background: #21759b;
transition: width 0.3s ease;
display: flex;
align-items: center;
justify-content: flex-end;
}

.transcoder-progress-bar .progress .progress-text {
color: #fff;
}
1 change: 1 addition & 0 deletions admin/css/rt-progress-bar.min.css

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

20 changes: 16 additions & 4 deletions admin/css/rt-transcoder-admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,15 @@

.transcoder-setting-form .form-table td {
font-size: 13px;
padding: 0 0 5px;
vertical-align: top;
}
padding: 5px;
display: inline-flex;
align-items: center;
flex-wrap: wrap;

& > p {
margin: 0;
}
}

.rtm-button-container {
margin-left: -20px;
Expand Down Expand Up @@ -167,7 +173,7 @@
.transcoder-setting-form .dashicons-info {
color: #aaa;
font-size: 14px;
height: 26px;
height: 100%;
line-height: 14px;
position: relative;
}
Expand Down Expand Up @@ -238,3 +244,9 @@
#adminmenu li.menu-top.current .wp-menu-image img {
opacity: 1;
}

.rtt-premium-feature {
opacity: 0.9;
background-color: rgba(250, 235, 215, 0.63);
border-radius: 0.5rem;
}
4 changes: 1 addition & 3 deletions admin/css/rt-transcoder-admin.min.css

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

4 changes: 1 addition & 3 deletions admin/css/rt-transcoder-client.min.css

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

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php return array('dependencies' => array('react', 'wp-api-fetch'), 'version' => 'af1c6d65e659f17b25f0');
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 Error: Missing file doc comment (Squiz.Commenting.FileComment.Missing).

Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 Error: Expected 1 space after the array opener in a single line array. Found: no spaces (NormalizedArrays.Arrays.ArrayBraceSpacing.SpaceAfterArrayOpenerSingleLine).

Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 Error: Expected 1 space before the array closer in a single line array. Found: no spaces (NormalizedArrays.Arrays.ArrayBraceSpacing.SpaceBeforeArrayCloserSingleLine).

Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 Error: When a multi-item array uses associative keys, each value should start on a new line (WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound).

2 changes: 1 addition & 1 deletion admin/js/build/rt-transcoder-block-editor-support.build.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions admin/js/jquery.ui.progressbar.min.1.7.2.min.js

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

12 changes: 12 additions & 0 deletions admin/js/rt-transcoder-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,18 @@
}
}
);

$( document ).on(
'click',
'#watermark-checkbox',
function( e ) {
if ( $( this ).is( ':checked' ) ) {
$( '#watermark-text' ).closest('tr').show();
} else {
$( '#watermark-text' ).closest('tr').hide();
}
}
);
}
);

Expand Down
7 changes: 1 addition & 6 deletions admin/js/rt-transcoder-admin.min.js

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

99 changes: 99 additions & 0 deletions admin/js/rt-transcoder-uploader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
(function($) {
$(document).ready(function() {
if (typeof wp === 'undefined' || typeof wp.Uploader === 'undefined') {
console.error('wp.Uploader is not available.');
return;
}

const progressBars = new Map();

// Check for existing video files in the media library.
setTimeout(checkExistingVideoProgress, 500);

// Listen for new files added to the queue.
wp.Uploader.queue.on('add', function(file) {
wp.Uploader.queue.on('reset', function() {
// Only show progress bar for video files.
if (file.attributes.type !== 'video') return;

attachmentId = file.id;
initializeProgressBar(attachmentId);
});
});

/**
* Initialize progress bar for the given attachment.
*
* @param {number} attachmentId
*/
function initializeProgressBar(attachmentId) {
const progressBar = $(
`<div class="transcoder-progress-bar" style="display: none;">
<div class="progress" style="width: 0%;">
<span class="progress-text">0%</span>
</div>
</div>`
);

const mediaItemPreview = $(`.attachments .attachment[data-id="${attachmentId}"] .attachment-preview`);
if (!mediaItemPreview.length) return;

mediaItemPreview.append(progressBar);
progressBars.set(attachmentId, progressBar);
monitorProgress(attachmentId);
}


/**
* Check for existing video files in the media.
*
*/
function checkExistingVideoProgress() {
const videoQuery = wp.media.query({
type: 'video',
posts_per_page: -1,
});

videoQuery.more().done(function() {
const videoAttachments = videoQuery.models;
videoAttachments.forEach(function(attachment) {
const attachmentId = attachment.id;
initializeProgressBar(attachmentId);
})
});
}


/**
* Monitor the transcoding progress of the given attachment.
*
* @param {number} attachmentId
*/
function monitorProgress(attachmentId) {
const progressBar = progressBars.get(attachmentId);
if (!progressBar) return;

$.ajax({
url: `${transcoderSettings.restUrl}/${attachmentId}`,
method: 'GET',
beforeSend: xhr => xhr.setRequestHeader('X-WP-Nonce', transcoderSettings.nonce),
success: function(data) {
const progress = parseFloat(data.progress) || 0;
progressBar.show();
progressBar.find('.progress').css('width', `${progress}%`);
progressBar.find('.progress-text').text(`${progress}%`);

if (progress < 100) {
setTimeout(() => monitorProgress(attachmentId), 5000);
} else {
progressBar.remove();
progressBars.delete(attachmentId);
}
},
error: function() {
setTimeout(() => monitorProgress(attachmentId), 5000);
}
});
}
});
})(jQuery);
Loading
Loading