diff --git a/src/pyj/read_book/iframe.pyj b/src/pyj/read_book/iframe.pyj index 27fe1cd3e9..607a1b156f 100644 --- a/src/pyj/read_book/iframe.pyj +++ b/src/pyj/read_book/iframe.pyj @@ -1031,7 +1031,7 @@ class IframeBoss: par = None else: par = smil_element_at(data.pos, self.smil_anchor_map, self.smil_par_list) - self.send_message('audio_ebook_message', type='start_play_at', par=par or None, anchor=data.anchor or None) + self.send_message('audio_ebook_message', type='start_play_at', par=par or None, anchor=data.anchor or None, pos=data.pos or None) else: console.error(f'Unknown audio ebook message type from main: {data.type}') diff --git a/src/pyj/read_book/read_audio_ebook.pyj b/src/pyj/read_book/read_audio_ebook.pyj index c69e3a59f3..07da8d9854 100644 --- a/src/pyj/read_book/read_audio_ebook.pyj +++ b/src/pyj/read_book/read_audio_ebook.pyj @@ -356,9 +356,14 @@ class ReadAudioEbook: # start playing from where we are self.send_message('play') return - self.pause() - error_dialog(_('Audio element not found'), _( - 'Could not play audio as no associated audio was found')) + if message.pos: + # this is a click ignore it as no smil element was found at + # click location + pass + else: + self.pause() + error_dialog(_('Audio element not found'), _( + 'Could not play audio as no associated audio was found')) elif message.type is 'marked': if message.anchor: self.last_marked_smil_id = message.anchor diff --git a/src/pyj/read_book/smil.pyj b/src/pyj/read_book/smil.pyj index bda0816fb2..eedb3d5476 100644 --- a/src/pyj/read_book/smil.pyj +++ b/src/pyj/read_book/smil.pyj @@ -110,8 +110,7 @@ def smil_element_at(pos, anchor_map, par_list): br = af.get_bounding_client_rect(elem) if br.x <= pos.x <= (br.x + br.width) and br.y <= pos.y <= (br.y + br.height): return par - # fallback to first visible anchor - return smil_element_at(None, anchor_map, par_list) + return None else: # use first visible anchor for par in par_list: if par.anchor and par.audio and is_anchor_on_screen(par.anchor):