Commit 3dc76668 authored by Steven杜宇's avatar Steven杜宇

// 解决静音模式下播放视频无声音问题

parent 3cdd4604
......@@ -18,6 +18,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
setupAudionConfig()
//初始化 神策sdk
YHAnalytics.analyticsStart(launchOptions: launchOptions)
......@@ -157,6 +159,18 @@ extension AppDelegate {
player?.pause()
}
}
private func setupAudionConfig() {
// 确保 AVAudioSession 被正确配置,以便在静音模式下也能正常播放音频
do {
try AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playback)
try AVAudioSession.sharedInstance().setActive(true)
} catch let error as NSError {
print("error: \(error.localizedDescription)")
}
}
}
......@@ -57,7 +57,7 @@ class YHUserInfoHeaderView: UIView {
private lazy var likeLabel:UILabel = {
let label = UILabel()
label.text = "点赞 0".local
label.textColor = UIColor(hex: 0x949DB5)
label.textColor = UIColor(hex: 0x121A26, transparency: 0.5)
label.textAlignment = NSTextAlignment.left
label.font = UIFont.PFSC_R(ofSize: 13)
label.isUserInteractionEnabled = true
......@@ -70,7 +70,7 @@ class YHUserInfoHeaderView: UIView {
private lazy var collectLabel:UILabel = {
let label = UILabel()
label.text = "收藏 0".local
label.textColor = UIColor(hex: 0x949DB5)
label.textColor = UIColor(hex: 0x121A26, transparency: 0.5)
label.textAlignment = NSTextAlignment.left
label.font = UIFont.PFSC_R(ofSize: 13)
label.isUserInteractionEnabled = true
......@@ -83,7 +83,7 @@ class YHUserInfoHeaderView: UIView {
private lazy var scanLabel:UILabel = {
let label = UILabel()
label.text = "最近浏览 0".local
label.textColor = UIColor(hex: 0x949DB5)
label.textColor = UIColor(hex: 0x121A26, transparency: 0.5)
label.textAlignment = NSTextAlignment.left
label.font = UIFont.PFSC_R(ofSize: 13)
label.isUserInteractionEnabled = true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment