Pārlūkot izejas kodu

fix: AudioPlayer 初始状态问题

Allen 4 gadus atpakaļ
vecāks
revīzija
7d03c9b939
1 mainītis faili ar 4 papildinājumiem un 1 dzēšanām
  1. 4
    1
      src/components/AudioPlayer/index.js

+ 4
- 1
src/components/AudioPlayer/index.js Parādīt failu

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