-
Notifications
You must be signed in to change notification settings - Fork 17
Feature/add transcoded url meta #296
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
Open
pranvinit
wants to merge
19
commits into
master
Choose a base branch
from
feature/add-transcoded-url-meta
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 13 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 3c83e8a
feature: add rt-player block
pranvinit 319757b
fix: add dynamic video type in save.js
pranvinit ec4b1dc
enhance: add post meta transcoded url as video source and fallback to…
pranvinit 0b7ded9
feature: add meta field for transcoded URL and option to toggle it
pranvinit 9ad669d
fix: phpcs comments
pranvinit 59ab2b9
chore: remove build from phpcs
pranvinit aed778d
enhance: extend webpack config to minify admin scripts and styles
pranvinit 58fc8eb
feature: add real-time transcoding progress to media uploads
pranvinit 54095d7
enhance: add progress count and show progress bar for existing media
pranvinit 1db432e
fix: empty progress bar on page load
pranvinit 3ca7e25
fix: make meta field publicly queryable
pranvinit 5cb6b57
fix: frontend quality selector not working
pranvinit 9808a21
feature: add watermark settings for paid users
pranvinit 4e03d60
feature: add support for image watermarks
pranvinit f4fa7f8
fix: has_access var and scripts enqueue
pranvinit 1e1ee7b
Update the watermark checkbox UI and move the admin page under media …
ca062ee
Pass the ABS and watermark argument on wp_media_transcoding request
b5cff1e
Implement the responisve media player block called EasyDAM Player usi…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
**/*.build.js | ||
**/node_modules/** | ||
**/vendor/** | ||
assets/** | ||
build | ||
node_modules | ||
Gruntfile.js |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,4 @@ sftp-config.json | |
*.sublime-workspace | ||
.editorconfig | ||
.cache/ | ||
package-lock.json |
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
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; | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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); |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.