turnermm / epub

Dokuwiki plugin for creating ebooks
http://www.dokuwiki.org/plugin:epub
15 stars 9 forks source link

Audio support? #23

Open ghost opened 7 years ago

ghost commented 7 years ago

Hi,

Love your plugin. Just wondering how difficult it would be to add support for audio? As in, could we turn a dokuwiki link to an MP3 or OGG file into something like:<audio src="audio/clip01.mp3"/>?

turnermm commented 7 years ago

Unfortunately I have no experience with audio files, podcasts etc. I would have supposed that the audio file would be linked to normally in the epub, but your ebook reader has to support it. Does the audio file requires a plugin? If so, then there might be some issues.

ghost commented 7 years ago

Thanks for the response! It's not so much a plugin issue as it is an html issue. When I export an epub, my images are correctly linked in the html as follows:

<img src="../Images/namespace_image.png" width="500" alt="../Images/namespace_image" class="mediacenter" />

This works great. However, the links to the audio files use an <a> tag in the html as follows, which ends up being broken:

<a href=''> :namespace:filename.ogg |</a>

What I'd love to see is for the links to audio files to use an <audio src> tag instead of <a>. Would that be possible to implement?

turnermm commented 7 years ago

Show me a sample page from your wiki with markup using an audio file

ghost commented 7 years ago

Sure thing. I'm working on a free digital textbook for some courses that I teach.

Here's a page: Chapter 4

The markup for the first audio link on that page is:

{{ :bridges_counterpoint:04-ex40.mp3 | :bridges_counterpoint:04-ex40.ogg |}}

Ideally, I'd like my students to be able to view the book using a computer, tablet, phone, or e-reader, provided their e-reader supports audio. Searching for e-reader/epub support for dokuwiki is how I found your wonderful plugin.

Thanks for your help!

turnermm commented 7 years ago

I saved one of your audio files and created a new branch as a test for audio files: https://github.com/turnermm/epub/archive/audio.zip You can install it using the manual tab of the Extension Manager.

It embeds the audio file and sets up the controls, but I'm afraid for me, it doesn't produce sound at least not on Calibre or Sigil.

ghost commented 7 years ago

Getting pretty close. When I export and download the epub, it includes the audio files, which is good! That didn't happen previously. When I open the epub in Apple iBooks, the controls for the player display, but - like you mentioned - it doesn't produce sound.

I think it might be a simple HTML path issue. In looking at the HTML for a sample page, I see this:

<img src="../Images/filename.png" ... >

(further down)

<audio class="mediacenter" controls="controls"> <source src=Audio/filename.mp3 ... >

Note the difference in the path for img src versus source src. If I change the path for the link to <source src="../Audio/filename.mp3 ... ", it works perfectly.

turnermm commented 7 years ago

I've made the change. Test it. Same distribution url: https://github.com/turnermm/epub/archive/audio.zip Still doesn't work in Calbre, which may require more sophisticated coding and which I'm not familiar with.

ghost commented 7 years ago

Hey, thanks! What I can tell you is that the audio works fine when viewing the HTML. I'll test it in iBooks tomorrow, but I suspect it will work as well.

I'm not even worried about Calibre. Any student I have who is sophisticated enough to use Calibre will come up with their own solution. Really, I just want the textbook to function decently on tablets with e-reader audio support (iPads, Kindle Fire, whatever). Looks like this is going to do the trick!

turnermm commented 7 years ago

I'll look forward to the details, sol that I can report on the plugin page how things go.

turnermm commented 7 years ago

I've discovered that in Firefox, on both Mac and Windows 10, the epubreader add-on plays back the mp3 files.
I've also added a possible help feature: for each audio file, I create a footnote, as with any other media type, so that it is possible to go to the footnotes page and save the mp3 file to the desktop by right-clicking and choosing "save as".

ghost commented 7 years ago

And I can confirm that on Apple iBooks, the audio files play perfectly.

Screenshot

I don't have an iPad (or similar) to test, but I suspect that everything should work just fine. Thanks for all your work! This is a great addition to your plugin.

turnermm commented 7 years ago

Try the latest and see what you think of the footnote link. I could set it up as a choice, and it might be possible to set up a tag to introduce the footnote and it should be centred (probably), to be parallel with the play icon.

ghost commented 7 years ago

Hmmm. I can see how the footnotes could be useful in an eBook with only the occasional audio file. In my case, with lots of audio examples per chapter, it makes for a cluttered and distracting look.

If it's set up as an option to use the footnote links, I'm in favor. Otherwise, I prefer the "minimal" look of picture with corresponding audio file.

turnermm commented 7 years ago

audio_1

I'm a step ahead of you on the option. But you should look at the current implementation of the footnote link. It's centered beneath the play controls and single-spaced. The option defaults to true, i.e. use the extra link.

turnermm commented 7 years ago

With latest update, the titles of the footnote text are taken from the markup: {{ mpeg_file|title }}

audio_2sm

Shakespeare, Sonnets.zip

turnermm commented 7 years ago

See https://www.dokuwiki.org/plugin:epub#audio_files. For the above to work correctly the audio files have to be in one of the namespaces set in the configuration manager, default is: audio or mpeg.

ghost commented 7 years ago

Just grabbed the new version. Your plugin keeps getting better and better. Many, many thanks for your work. I like the centered footnotes, as well as the option to use the titles instead of the file name. Awesome!

One little thing: this looks like a typo in Configuration Settings (for plugin»epub»audio_nmsp). It currently reads, Comma separated list of namespaces where audioi file will be found.

Shouldn't that be audio files? (Sorry to nitpick.)

turnermm commented 7 years ago

Thanks for pointing out the typo. I had made the correction but hadn't saved the file. Next thing I might look into is video, but that seems to be more of a problem in Dokuwiki. This option if needed only for the footnotes. If you aren't using footnotes with the audio files, then the audio files can be in any namespace.

robinul commented 4 years ago

I have developed a fixed page eBook with Mac Pages, then exported to ePUB. Audio works fine on Mac BOOKS and Abode Digital Editions. On PCs, Adobe Digital Editions works fine except it will not play the audio files. If I use a simple Pages file (not a Book Template file) with free flowing format, the audio files play in ADE but then lose the fixed page format (which is necessary for the book I have written. Any help would be appreciated.

turnermm commented 4 years ago

Al I can offer you in the way of audio is what you find here on this page. I personally do not have experience with audio reproduction and file formats.

robinul commented 4 years ago

Thanks for your quick response,

On Jun 12, 2020, at 8:13 AM, Myron Turner notifications@github.com wrote:

It's been three years since I dealt with the issue of audia. But this might be helpful: #23 https://github.com/turnermm/epub/issues/23 — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/turnermm/epub/issues/23#issuecomment-643291938, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN2ZAYLFOMKAJ2M54AZK3Y3RWIZYHANCNFSM4DTLGBJA.