K00B404 commited on
Commit
0fa6343
·
verified ·
1 Parent(s): e79a540

Update thaTube.py

Browse files
Files changed (1) hide show
  1. thaTube.py +4 -6
thaTube.py CHANGED
@@ -46,14 +46,12 @@ class thaTube:
46
  self.current_audio_file = mp3_file.name
47
  return self.current_audio_file
48
 
49
- def play_audio(self):
50
- """Play the extracted audio."""
51
  if not self.current_audio_file:
52
  raise ValueError("No audio file to play. Please extract audio first.")
53
-
54
- self.current_audio = pygame.mixer.Sound(self.current_audio_file)
55
- self.current_audio.play()
56
- self.is_playing = True
57
 
58
  def stop_audio(self):
59
  """Stop the currently playing audio."""
 
46
  self.current_audio_file = mp3_file.name
47
  return self.current_audio_file
48
 
49
+ def play_audio(self):
50
+ """Play the extracted audio using Streamlit's audio player."""
51
  if not self.current_audio_file:
52
  raise ValueError("No audio file to play. Please extract audio first.")
53
+ audio_bytes = open(self.current_audio_file, 'rb').read()
54
+ st.audio(audio_bytes, format='audio/mpeg', start_time=0)
 
 
55
 
56
  def stop_audio(self):
57
  """Stop the currently playing audio."""