无故事王国
2024-06-12 21656936d06a8ea01d8d9ce4fdb1dbe0bb2e8419
DolphinEnglishLearnStudent/Other/UIView/VoiceHandleView.swift
@@ -28,6 +28,7 @@
            var playUrl:String?
            var listenType:ListenType?
            private var playAtClouse:((Int)->Void)?
            override init(frame: CGRect) {
                        super.init(frame: frame)
@@ -70,18 +71,35 @@
                        fatalError("init(coder:) has not been implemented")
            }
            func copyView()->VoiceHandleView{
                        let copyView = VoiceHandleView()
                        copyView.listenType = self.listenType
                        copyView.playUrl = self.playUrl
                        copyView.frame = self.frame
                        return copyView
            }
            func resetView(){
                        img_hint.isHidden = false
                        btn_play.isHidden = false
                        img_hint_playing.isHidden = true
            }
            func playing(){
                        img_hint.isHidden = true
                        btn_play.isHidden = true
                        img_hint_playing.isHidden = false
            }
            func playAt(_ clouse:@escaping(Int)->Void){
                        self.playAtClouse = clouse
            }
            @objc func playingAction(){
                        if let url = playUrl{
                                    playAtClouse?(self.tag)
                                    VoicePlayer.share().playerAt(url: url)
                                    img_hint.isHidden = true
                                    btn_play.isHidden = true
                                    img_hint_playing.isHidden = false
                                    playing()
                        }
            }