是否可以像在Netflix App中一样滚动视频时间轴时制作预览图像?

时间:2019-07-06 14:05:33

标签: swift avplayer tvos

是否可以在列出视频时间轴时制作peview图片,例如在带有AVPlayer的Ne​​tflix App中? exmple here

已更新。我发现mp4视频具有该预览窗口,但m3u8格式没有它

此处的代码:

func playVideo(cell:  MovieCell) {
        guard let urlVideo = URL(string: cell.movieSrc) else {
            return
        }
        // Create an AVPlayer, passing it the HTTP Live Streaming URL.
        let player = AVPlayer(url: urlVideo)


        // Create a new AVPlayerViewController and pass it a reference to the player.
        let controller = AVPlayerViewController()
        controller.player = player

        // Modally present the player and call the player's play() method when complete.
        self.present(controller, animated: true) {
            player.play()
        }
    }

1 个答案:

答案 0 :(得分:0)

这被称为“技巧游戏”,必须包含在AVPlayer的HLS清单中才能为您处理。

请参见Trick Play中的HLS Authoring Specification for Apple Devices部分:

  

6.1。必须提供I帧播放列表(EXT-X-I-FRAME-STREAM-INF)以支持清理和扫描UI。