Browse Source

fix: AudioPlayer 初始状态问题

Allen 4 years ago
parent
commit
7d03c9b939
1 changed files with 4 additions and 1 deletions
  1. 4
    1
      src/components/AudioPlayer/index.js

+ 4
- 1
src/components/AudioPlayer/index.js View File

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