Преглед изворни кода

fix: AudioPlayer 初始状态问题

Allen пре 4 година
родитељ
комит
7d03c9b939
1 измењених фајлова са 4 додато и 1 уклоњено
  1. 4
    1
      src/components/AudioPlayer/index.js

+ 4
- 1
src/components/AudioPlayer/index.js Прегледај датотеку

@@ -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