gpt4 book ai didi

ios - 提供的 Assets 名称无效 : '(null)'

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:23:28 26 4
gpt4 key购买 nike

我正在尝试制作一个 iPhone 应用程序,您按下一个按钮,它就会通过 MAMP 将视频从我的 mac 流式传输到手机。当我按下按钮时,播放器出现,但视频不播放,我收到此错误。

2018-03-15 10:19:30.487597-0500 stream[5956:2522500] CredStore - performQuery - Error copying matching creds.  Error=-25300, query={
class = inet;
"m_Limit" = "m_LimitAll";
"r_Attributes" = 1;
sync = syna;
}
2018-03-15 10:19:30.644950-0500 stream[5956:2522500] [] <<<< AVOutputDeviceDiscoverySession (FigRouteDiscoverer) >>>> -[AVFigRouteDiscovererOutputDeviceDiscoverySessionImpl outputDeviceDiscoverySessionDidChangeDiscoveryMode:]: Setting device discovery mode to DiscoveryMode_None (client: stream)
2018-03-15 10:19:30.714388-0500 stream[5956:2522500] [framework] CUICatalog: Invalid asset name supplied: '(null)'
2018-03-15 10:19:30.714440-0500 stream[5956:2522500] [framework] CUICatalog: Invalid asset name supplied: '(null)'
2018-03-15 10:19:30.763593-0500 stream[5956:2522500] [] <<<< AVOutputDeviceDiscoverySession (FigRouteDiscoverer) >>>> -[AVFigRouteDiscovererOutputDeviceDiscoverySessionImpl outputDeviceDiscoverySessionDidChangeDiscoveryMode:]: Setting device discovery mode to DiscoveryMode_Presence (client: stream)
2018-03-15 10:19:30.846707-0500 stream[5956:2522500] [framework] CUICatalog: Invalid asset name supplied: '(null)'
2018-03-15 10:19:30.846763-0500 stream[5956:2522500] [framework] CUICatalog: Invalid asset name supplied: '(null)'

完整代码如下:

import UIKit
import AVKit
import AVFoundation

class ViewController: UIViewController {
@IBAction func playVideo(_ sender: Any) {
guard let url = URL(string: "http://host-2:8888/The Serenity Trance Sample Pack (138 bpm Loops, Vocals, Drums, Snares, Presets, and more!).m3u8") else {
return
}
// Create an AVPlayer, passing it the HTTP Live Streaming URL.
let player = AVPlayer(url: url)

// 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.
present(controller, animated: true) {
player.play()
}
}
}

最佳答案

问题是您的 URL 字符串未编码,因此 URLnil 并且您的函数从 guard 语句的主体返回.

guard let encodedUrlString = "http://host-2:8888/The Serenity Trance Sample Pack (138 bpm Loops, Vocals, Drums, Snares, Presets, and more!).m3u8".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed), let url = URL(string: encodedUrlString) else {     
print("Invalid URL")
return
}

关于ios - 提供的 Assets 名称无效 : '(null)' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49303357/

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