소스 검색

fix: AudioPlayer 初始状态问题

Allen 5 년 전
부모
커밋
7d03c9b939
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4
    1
      src/components/AudioPlayer/index.js

+ 4
- 1
src/components/AudioPlayer/index.js 파일 보기

60
         });
60
         });
61
       this.player.onpause = () =>
61
       this.player.onpause = () =>
62
         this.setState({ isPlaying: false, isLoading: false });
62
         this.setState({ isPlaying: false, isLoading: false });
63
-      this.player.onplay = () => this.setState({ isLoading: true });
63
+      // this.player.onplay = () => this.setState({ isPlaying: false });
64
       this.player.ontimeupdate = event =>
64
       this.player.ontimeupdate = event =>
65
         this.setState({ currentDuration: event.target.currentTime });
65
         this.setState({ currentDuration: event.target.currentTime });
66
       this.player.src = this.props.src;
66
       this.player.src = this.props.src;
84
         });
84
         });
85
       }
85
       }
86
       this.player.play();
86
       this.player.play();
87
+      this.setState({
88
+        isLoading: true
89
+      });
87
     }
90
     }
88
   }
91
   }
89
 
92