Commit 918e99ad authored by Steven杜宇's avatar Steven杜宇

// 视频播放设置

parent f0025b6e
......@@ -252,6 +252,7 @@
049A48A82B49417300D0C641 /* YHAboutUsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */; };
049A48AA2B49536000D0C641 /* YHAboutUsAdvantageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049A48A92B49536000D0C641 /* YHAboutUsAdvantageCell.swift */; };
049AB5EE2C0EF68700155DDF /* YHOrderTipsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049AB5ED2C0EF68700155DDF /* YHOrderTipsView.swift */; };
049AB5F02C0F339200155DDF /* YHVideoPlaySettingVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049AB5EF2C0F339200155DDF /* YHVideoPlaySettingVC.swift */; };
049AC4C62BC3E55300F857F4 /* YHServiceSectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049AC4C52BC3E55300F857F4 /* YHServiceSectionView.swift */; };
04A271232BABFF3200652B1B /* YHCertificateUploadTypeCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A271222BABFF3200652B1B /* YHCertificateUploadTypeCell.swift */; };
04A271252BAC33BB00652B1B /* YHFilePreviewTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A271242BAC33BB00652B1B /* YHFilePreviewTool.swift */; };
......@@ -728,6 +729,7 @@
049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutUsViewController.swift; sourceTree = "<group>"; };
049A48A92B49536000D0C641 /* YHAboutUsAdvantageCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutUsAdvantageCell.swift; sourceTree = "<group>"; };
049AB5ED2C0EF68700155DDF /* YHOrderTipsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOrderTipsView.swift; sourceTree = "<group>"; };
049AB5EF2C0F339200155DDF /* YHVideoPlaySettingVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHVideoPlaySettingVC.swift; sourceTree = "<group>"; };
049AC4C52BC3E55300F857F4 /* YHServiceSectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHServiceSectionView.swift; sourceTree = "<group>"; };
04A271222BABFF3200652B1B /* YHCertificateUploadTypeCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateUploadTypeCell.swift; sourceTree = "<group>"; };
04A271242BAC33BB00652B1B /* YHFilePreviewTool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFilePreviewTool.swift; sourceTree = "<group>"; };
......@@ -2217,6 +2219,7 @@
A5ACE8EA2B4564F7002C94D2 /* YHMyViewController.swift */,
04C693612B723AB8004C1758 /* YHMySettingViewController.swift */,
0414BDA82BC7E81500225367 /* YHMyPermissionSettingVC.swift */,
049AB5EF2C0F339200155DDF /* YHVideoPlaySettingVC.swift */,
0414BDAC2BC7F02C00225367 /* YHMyNotifySettingVC.swift */,
049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */,
048B2A492BC7D9DC00A93BF0 /* YHMyLikeViewController.swift */,
......@@ -2982,6 +2985,7 @@
045EEEAB2B9F171A0022A143 /* YHImageClipperViewController.swift in Sources */,
044414032BC39B8D00784A14 /* YHServerTableHeadView.swift in Sources */,
045EEECB2B9F171A0022A143 /* YHScoreResultBaseModel.swift in Sources */,
049AB5F02C0F339200155DDF /* YHVideoPlaySettingVC.swift in Sources */,
04A7BD192BA441D400BD35A2 /* YHMyDocumentsUrlModel.swift in Sources */,
04174D792BCD5B74000BA46D /* YHMessageSessionCell.swift in Sources */,
045EEEA62B9F171A0022A143 /* YHCompanySelectViewController.swift in Sources */,
......
......@@ -63,6 +63,7 @@ class YHMySettingViewController: YHBaseViewController, ConstraintRelatableTarget
#if DEBUG
return [PersonalModuleItem(title: "通知设置".local, type:.notifySettings),
PersonalModuleItem(title: "权限设置".local, type:.permissionSettings),
PersonalModuleItem(title: "播放设置".local, type:.playSettings),
PersonalModuleItem(title: "关于我们".local, type:.aboutUs),
PersonalModuleItem(title: "用户条款".local, type:.userItems),
PersonalModuleItem(title: "隐私协议".local, type:.privaceAgreement),
......@@ -72,6 +73,7 @@ class YHMySettingViewController: YHBaseViewController, ConstraintRelatableTarget
#elseif TESTENV
return [PersonalModuleItem(title: "通知设置".local, type:.notifySettings),
PersonalModuleItem(title: "权限设置".local, type:.permissionSettings),
PersonalModuleItem(title: "播放设置".local, type:.playSettings),
PersonalModuleItem(title: "关于我们".local, type:.aboutUs),
PersonalModuleItem(title: "用户条款".local, type:.userItems),
PersonalModuleItem(title: "隐私协议".local, type:.privaceAgreement),
......@@ -80,6 +82,7 @@ class YHMySettingViewController: YHBaseViewController, ConstraintRelatableTarget
#else
return [PersonalModuleItem(title: "通知设置".local, type:.notifySettings),
PersonalModuleItem(title: "权限设置".local, type:.permissionSettings),
PersonalModuleItem(title: "播放设置".local, type:.playSettings),
PersonalModuleItem(title: "关于我们".local, type:.aboutUs),
PersonalModuleItem(title: "用户条款".local, type:.userItems),
PersonalModuleItem(title: "隐私协议".local, type:.privaceAgreement),
......@@ -259,6 +262,10 @@ extension YHMySettingViewController : UITableViewDelegate, UITableViewDataSource
let vc = YHMyPermissionSettingVC()
self.navigationController?.pushViewController(vc)
} else if item.type == .playSettings {
let vc = YHVideoPlaySettingVC()
self.navigationController?.pushViewController(vc)
} else if item.type == .aboutUs {
let vc = YHAboutUsViewController()
self.navigationController?.pushViewController(vc)
......
......@@ -24,6 +24,7 @@ enum YHPersonalModuleItemType: Int {
case notifySettings
case permissionSettings
case playSettings
case infoCollectList
case infoShareList
case aboutUs
......
//
// YHVideoPlaySettingVC.swift
// galaxy
//
// Created by edy on 2024/6/4.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
let kVideoPlaySilentSettingKey = "kVideoPlaySilentSettingKey"
func getVideoPlaySilentSettings() -> Bool {
// 默认不静音
let playSlicent = UserDefaults.standard.bool(forKey: kVideoPlaySilentSettingKey)
return playSlicent
}
func saveVideoPlaySilentSetting(_ silent: Bool) {
UserDefaults.standard.set(silent, forKey: kVideoPlaySilentSettingKey)
UserDefaults.standard.synchronize()
}
class YHVideoPlaySettingVC: YHBaseViewController {
lazy var titleLabel:UILabel = {
let label = UILabel()
label.textColor = UIColor(hexString:"#121A26")
label.textAlignment = NSTextAlignment.left
label.font = UIFont.PFSC_R(ofSize:15)
label.text = "播放视频时默认静音"
return label
}()
lazy var switchBtn:UISwitch = {
let switchBtn = UISwitch()
switchBtn.onTintColor = UIColor.brandMainColor
switchBtn.addTarget(self, action: #selector(switchViewChange), for: .valueChanged)
switchBtn.tintColor = .brandMainColor
switchBtn.isOn = getVideoPlaySilentSettings()
return switchBtn
}()
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
}
@objc func switchViewChange() {
saveVideoPlaySilentSetting(switchBtn.isOn)
}
func setupUI() {
gk_navTitle = "播放设置".local
view.backgroundColor = .white
let itemView = UIView()
itemView.backgroundColor = .white
view.addSubview(itemView)
itemView.addSubview(titleLabel)
let btnView = UIView()
btnView.addSubview(switchBtn)
itemView.addSubview(btnView)
itemView.snp.makeConstraints { make in
make.left.right.equalTo(0)
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.height.equalTo(53.0)
}
titleLabel.snp.makeConstraints { make in
make.left.equalTo(21)
make.right.equalTo(switchBtn.snp.left).offset(-21)
make.centerY.equalToSuperview()
}
btnView.snp.makeConstraints { make in
make.right.equalTo(-21)
make.centerY.equalToSuperview()
make.height.equalTo(22)
make.width.equalTo(btnView.snp.height).multipliedBy(5.0/3.0)
}
}
override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
switchBtn.transform = CGAffineTransform(scaleX: 0.70, y: 0.70)
switchBtn.snp.updateConstraints { make in
make.left.equalTo(-7)
make.centerY.equalToSuperview()
}
}
}
......@@ -12,7 +12,7 @@ import AVFoundation
class YHVideoPlayerControlView: BMPlayerControlView {
var isSilient = true {
var isSilient = false {
didSet {
self.player?.avPlayer?.isMuted = isSilient
let imgName = isSilient ? "video_volume_disable" : "video_volume_enable"
......@@ -22,7 +22,7 @@ class YHVideoPlayerControlView: BMPlayerControlView {
lazy var volumeBtn = {
let btn = UIButton()
btn.setImage(UIImage(named: "video_volume_disable"), for: .normal)
btn.setImage(UIImage(named: "video_volume_enable"), for: .normal)
btn.addTarget(self, action: #selector(didVolumeBtnClicked), for: .touchUpInside)
btn.YH_clickEdgeInsets = UIEdgeInsets(top: 20, left: 30, bottom: 20, right: 20)
return btn
......
......@@ -25,8 +25,8 @@ class YHVideoPlayerVC: YHBaseViewController {
return YHHomeWebViewModel()
}()
// 默认静音
var isVolumeDisable = true
// 默认静音
var isVolumeDisable = getVideoPlaySilentSettings()
lazy var videoControlView:YHVideoPlayerControlView = {
let view = YHVideoPlayerControlView()
......
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