Add functionality to upload captions from local filesystem #1464
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.
Added functionality to upload captions.
Here's a demo
Link to related issue (if applicable)
Summary of proposed changes
The default config's
captions
property has been changed as follows:If
captions.upload.enabled
is set to true, then:A hidden
<input type="file">
object is created and listeners are set up for this. When the 'Upload Captions' option is clicked, a click is simulated on this<input type="file">
element which allows the user to upload a file.The default configuration only allows uploading VTT files and has no callbacks for the developers to make any changes. However, by setting
captions.upload.callback = true
, the developer can listen for the event specified undercaptions.upload.onInput
to know when the user has selected a file and perform operations on the file's text. These operations may involve converting from various formats into the WebVTT format. Once all operations are completed, the developer is expected to trigger the event specified undercaptions.upload.onProcessed
to tell Plyr to add the processed text as aTextTrack
.Checklist
develop
as the base branch/dist
changes) from the PR