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.
Description of the Change
This PR introduces better handling for video duration, removing the overlay-dependent method.
It also introduces some variables and frontendCommunicator events related to media duration.
$audioDuration and $videoDuration take a file path or URL and return the floating point duration when successful, [NO URL PROVIDED] when no URL/Path is provided and [ERROR FETCHING DURATION] when there is an error.
$youtubeVideoDuration takes a URL (eg. https://youtu.be/dQw4w9WgXcQ) or ID (dQw4w9WgXcQ) and returns the duration as an integer. When no ID or URL is provided, [NO VIDEO ID PROVIDED] is returned. [ERROR FETCHING DURATION] is returned if there's an error.
frontendCommunicator.fireEventAsync("getVideoDuration", path: string);
frontendCommunicator.fireEventAsync("getYoutubeVideoDuration", id: string);
Applicable Issues
#2058
Testing
Extensive testing has been done with both the variables and changes to the play video effect.
Variables
Relative paths will always cause error messages. Absolute paths are detected properly.
URLs require http:// or https:// to be prepended at all times.
Play Video Effect
The play video effect doesn't deadlock anymore if the requested overlay is not available. In addition, Youtube now works with shorts as well as regular videos. This has been tested extensively over many different video files and youtube links, including long/large video files that used to break before.