vkr / multimedia-analyzer-bundle
A bundle for Symfony2/3 that analyzes multimedia file duration using GetID3
Installs: 20
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.6
- symfony/symfony: ~2.8|~3.0
- vkr/getid3: ~2.1
- vkr/settings-bundle: ~1.1
Requires (Dev)
- phpunit/phpunit: >=5.4
This package is auto-updated.
Last update: 2024-10-20 23:37:12 UTC
README
This is a very simple bundle that currently does just one thing - gets the length of a video or audio file in seconds. It has a dependency on VKRSettingsBundle and it also depends on an object-oriented version of GetID3 library. The dependency on GetID3 is my fork of phansys/getid3 that is compatible with PHP 7.
Installation
Nothing to install except for standard Symfony bundle installation procedure.
Usage
There is just a single public method that needs to be called as follows:
$analyzer = $this->get('vkr_multimedia_analyzer.multimedia_duration_analyzer');
$file = new Symfony\Component\HttpFoundation\File('/path/to/file');
try {
$length = $analyzer->getFileDuration($file);
} catch (MultimediaAnalyzerException $e) {
// handle exception
}
If the file is not a multimedia file, 0 will be returned.
You may also use VKRSettingsBundle in this manner:
$maximumLengthSetting = 'maximum_length';
$length = $analyzer->getFileDuration($file, $maximumLengthSetting);
Here, if the file duration is longer than maximum, MultimediaAnalyzerException
will be thrown.