我已经遇到了一段时间的问题,在某些ios设备上,我的webaudio系统似乎只能与耳机配合使用,其他设备(完全相同的操作系统,型号等)音频通过扬声器或耳机播放得非常好.我已经搜索过这个问题的解决方案但是没有找到关于这个问题的任何内容.我唯一能想到的是它可能是一个音频通道问题.我很难过.有没有人遇到过这个问题,或者有任何修复建议?谢谢!
下面是我目前拥有的代码。如何为 swiftUI 启用内联媒体播放?我希望视频在出现网络视图时自动播放。下面是我到目前为止的代码。提前致谢。
Button(action: {
self.isPlayed.toggle()//toggles the boolean isPlayed
self.appear.toggle()//toggles the boolean appear
}, label: {
//if the boolean of isPlayed and
if isPlayed && appear{
Image(systemName: "pause")
.font(Font.system(size: 30))
} else{
Image(systemName:"play")
.font(Font.system(size: 30))
}
})
Spacer()
}
if appear == true{
WebView(request: URLRequest(url: URL(string: "http:www.\(websites[counter])?playsinline=1")!))
.frame(width:300, height:300)
.padding()
.opacity(1)
}
}
}
}
struct WebView: UIViewRepresentable {
let request: URLRequest//pass the website to webkit
func makeUIView(context: Context) -> WKWebView {
return WKWebView()
}
func updateUIView(_ uiView: WKWebView, context: …
Run Code Online (Sandbox Code Playgroud)