/** * 合并M3U8 */ public function merge($content) { $firstMaxDuration = $this->parseSegmentMaxDuration(); $firstSegmengBodyStartPos = $this->getSegmentBodyStartPos(); $firstPart1 = trim(substr($this->content, 0, $firstSegmengBodyStartPos)); $firstPart2 = trim(substr($this->content, $firstSegmengBodyStartPos)); $modifier = new self($content); $secondMaxDuration = $modifier->parseSegmentMaxDuration(); $secondBody = $modifier->cutSegmentBody(); return $this->content = $firstPart1 . "\n" . $secondBody . "\n#EXT-X-DISCONTINUITY\n" . $firstPart2; }