Captioning\Format\JsonCue::setDuration PHP Method

setDuration() public method

public setDuration ( $duration )
$duration
    public function setDuration($duration)
    {
        $this->duration = $duration;
        return $this;
    }

Usage Example

Beispiel #1
0
 public function parse()
 {
     $decodedContent = json_decode($this->fileContent, true);
     if (!isset($decodedContent['captions'])) {
         throw new \InvalidArgumentException('Invalid JSON subtitle');
     }
     if (count($decodedContent['captions']) > 0) {
         foreach ($decodedContent['captions'] as $c) {
             $cue = new JsonCue($c['startTime'], $c['startTime'] + $c['duration'], $c['content']);
             $cue->setDuration($c['duration']);
             $cue->setStartOfParagraph($c['startOfParagraph']);
             $this->addCue($cue);
         }
     }
     return $this;
 }