我是Swift和視頻流的新手。我正嘗試在AppleTV中播放視頻。 有人試圖從外部srt文件中迅速添加字幕與AVPlayerViewController。我正在嘗試使用以下代碼執行相同的操作:https://github.com/mhergon/MPMoviePlayerController-Subtitles。用swift顯示使用AVPlayerViewController的字幕
我改變,以適應我的要求的代碼,但它拋出一個異常:
NSInvalidArgumentException「的,理由是:」無法解析約束格式: 無法解釋‘|’ (20) - [1] - (20) - |
同時在Subtitles.swift文件這一點:
var constraints = NSLayoutConstraint.constraintsWithVisualFormat("H:|-(20)-[l]-(20)-|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: ["l" : subtitleLabel!])
subtitleContainer?.addConstraints(constraints)
你可以在storyboard或xib上顯示配置你的視圖嗎?或者在代碼中設置列表元素視圖? –