gpt4 book ai didi

ios - 从 Alamofire 下载的视频未在横向模式下播放

转载 作者:行者123 更新时间:2023-11-28 07:34:01 24 4
gpt4 key购买 nike

我正在通过 Alamofire 下载视频,当我在与 swift 兼容的任何播放器中播放该视频时,视频仅以纵向模式播放。我还需要以横向模式播放视频。这是我的代码-

' request = Alamofire.download(videoImageUrl!,到:目的地).downloadProgress {进度

   self.isDownloading = true

print("\(floor(progress.fractionCompleted*100))%")
self.downloadingView.downloadPercentagaeView.text = "\(Int(floor(progress.fractionCompleted*100)))% of \(String(format: "%.1f", (Double(sizeOfVideo) * 0.000001)))MB"
}

.response { response in
if let error = response.error {
print(error)
if self.isDownloadCancelled == false {
if !HasfitHelper.shared.isInternetConnected {

let internetErrorView = internetDisconnectedView.internetAlertView() as! UIView

internetErrorView.frame = UIScreen.main.bounds
internetDisconnectedView.internetDisconectedDelegate = self
HasfitHelper.mainWindow().rootViewController?.view.addSubview(internetErrorView)

}
if response.resumeData != nil {
self.dataCache.set(response.resumeData!, forKey: videoImageUrl!)
print(self.dataCache.value(forKey: videoImageUrl!) as Any)
}}

if self.isDownloadCancelled == true
{
self.dataCache.set(nil, forKey: videoImageUrl!)
print(self.dataCache.value(forKey: videoImageUrl!) as Any)
return
}
}
if response.destinationURL != nil {

print(response.destinationURL!)



self.downloadVideoForOfflineButton.setImage(UIImage(named:"download_filled_icon"), for: .normal)
self.isDownloaded = true
self.offlineVideoUrl = "\(response.destinationURL!)"
self.dataCache.set(nil, forKey: videoImageUrl!)



self.tableView.reloadData()
if self.isfavorite == false {
self.rightPressed(self)
}
let remoteImageURL = URL(string: (self.workoutInfoDict[kAPIParam.thumbnail] as? String)!)
Alamofire.request(remoteImageURL!).responseData { (responseImage) in
if responseImage.error == nil {
print(responseImage.result)
let dict = ["post_id":self.postID,"file_url":"\(response.destinationURL!)","thumbnail":self.workoutInfoDict[kAPIParam.thumbnail]!,"post_name":self.workoutInfoDict[kAPIParam.postName]!,"thumbnailData":responseImage.data!] as [String : Any]

var offlineDict = UserDefaults.standard.value(forKey: "offlineDict") as! [Any]
offlineDict.append(dict)
UserDefaults.standard.set(offlineDict, forKey: "offlineDict")
UserDefaults.standard.synchronize()
self.downloadingView.removeFromSuperview()
self.isDownloading = false
}

'

最佳答案

请检查您应用的 info.plist 中的设备方向。

要获取横向视频,您可能需要为您的应用选中横向模式。

虽然我不确定这是否能解决您的问题,但值得一试。

enter image description here

关于ios - 从 Alamofire 下载的视频未在横向模式下播放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53759189/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com