MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Sigil (https://www.mobileread.com/forums/forumdisplay.php?f=203)
-   -   Sigil with audio files (https://www.mobileread.com/forums/showthread.php?t=258751)

smarsten 04-04-2015 07:49 PM

Sigil with audio files
 
Does anyone know that when you embed an audio file with Sigil into an epub that Sigil creates an icon that must be clicked to play the audio file, or does the audio file automatically get played when the page where it is embedded is displayed/opened?

Steve

theducks 04-04-2015 11:51 PM

Quote:

Originally Posted by smarsten (Post 3077242)
Does anyone know that when you embed an audio file with Sigil into an epub that Sigil creates an icon that must be clicked to play the audio file, or does the audio file automatically get played when the page where it is embedded is displayed/opened?

Steve

Sigil is EPUB2 ... No audio in EPUB2, But Sigil no longer tosses EPUB3 residue :p when it finds it.

Toxaris 04-05-2015 03:06 AM

In other words, it is similar to images. You can add the audio file to the ePUB, but playing it must be done in the coding yourself. There is not a button for that like for an image.

Doitsu 04-05-2015 05:48 AM

3 Attachment(s)
Quote:

Originally Posted by smarsten (Post 3077242)
Does anyone know that when you embed an audio file with Sigil into an epub that Sigil creates an icon that must be clicked to play the audio file, or does the audio file automatically get played when the page where it is embedded is displayed/opened?

As other posters have already pointed out, sound playback is an ePub3 feature that very few readers and apps support, and Sigil is an ePub2 editor with limited embedded media support.

As for the playback controls, AFAIK, they don't need to be explicitly defined.

Sigil playback controls support appears to be OS-dependent:

Windows: The official Windows Sigil 0.8.5 release automatically displays disabled playback controls.
Linux: DiapDealer's unofficial Sigil Linux 0.8.5 release automatically displays working playback controls.
OSX: Sigil audio/video playback works, according to KevinH.

(The test file is a valid ePub3 file that works with iBooks, Gitden Reader, ADE 4 and Readium.)

Here's the HTML code:

Spoiler:
Code:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
<head>
  <title/>
</head>

<body>
  <h3>ePub audio test</h3>

  <h4 id="sigil_toc_id_1">Left Speaker Test:</h4>

  <audio controls="controls" src="../Audio/left.mp3">Your app/device does not support the audio element.</audio>

  <h4 id="sigil_toc_id_2">Right Speaker Test:</h4>

  <audio controls="controls" src="../Audio/right.mp3">Your app/device does not support the audio element.</audio>

  <p>Audio files courtesy of <a href="http://www.richardfarrar.com/are-your-speakers-wired-correctly/">RichardFarrar.com</a>.</p>
</body>
</html>


DiapDealer 04-05-2015 07:10 AM

If I remember correctly, the audio/video folders were added and some bare minimum coding was done to ensure that Sigil didn't break existing (working) epubs that had video/audio in them. But I don't believe adding/editing/playing has ever been supported (though playing might work depending on OS and video/audio codec).

It was a "first do no harm" sort of step toward audio/video support.

KevinH 04-05-2015 01:00 PM

Hi
Video seems to work for me with the latest Qt and some added style to makes the controls appear.

Doitsu 04-05-2015 01:48 PM

Quote:

Originally Posted by KevinH (Post 3077558)
Hi
Video seems to work for me with the latest Qt and some added style to makes the controls appear.

Can you post a sample file or the control styles that you used?

KevinH 04-05-2015 02:10 PM

Hi,
To create a test case I used the html Sigil uses if you double-click in the Browser pane to open a Tab with audio and or video.

Here are those code snippets. You just need to replace the src="" link with ../Video/your_movie_name.mp4

Code:

const QString AUDIO_HTML_BASE =
    "<html>"
    "<head>"
    "<style type=\"text/css\">"
    "body { -webkit-user-select: none; }"
    "audio { display: block; margin-left: auto; margin-right: auto; }"
    "</style>"
    "<body>"
    "<p><audio controls=\"controls\" src=\"%1\"></audio></p>"
    "</body>"
    "</html>";

const QString VIDEO_HTML_BASE =
    "<html>"
    "<head>"
    "<style type=\"text/css\">"
    "body { -webkit-user-select: none; }"
    "video { display: block; margin-left: auto; margin-right: auto; }"
    "</style>"
    "<body>"
    "<p><video controls=\"controls\" width=\"560\" src=\"%1\"></video></p>"
    "</body>"
    "</html>";

i will post an example epub when I am back in front of my computer.

KevinH

KevinH 04-05-2015 02:27 PM

1 Attachment(s)
Hi Doitsu,

I tested with Sigil from my master which now keeps even more of the epub3 features and your audio file (both channels) showed up and played just fine and worked correctly in BookView and Preview.

I am attaching an epub_video_test_epub3.epub (it is an epub3 based only on the package version tag). It works on Mac OS X also.

I also tested with stock Sigil 0.8.5 on Mac OS X and both audio and video tests work. The only issue is after saving the video in Sigil 0.8.5, the media-type was incorrectly changed to text/plain in the content.op manifest, which prevented it from working after a reload. This bug is fixed in my Sigil master.

Hope this helps,

Kevin

Doitsu 04-05-2015 03:14 PM

Hi KevinH,

Thanks for the funny test file. I tested it with DiapDealer's unofficial Sigil 0.8.5 Linux release on Debian 8 and the playback worked fine, even when I unlinked the stylesheet. Of course, the 0.8.5 Windows version didn't work.

D.

KevinH 04-05-2015 03:21 PM

Hi,

Yes, the code to deal with audio and video is inherent across the 3 platforms and built into the Qt QWebView widget. There is no bug from the Sigil end here. This seems to be an issue in QWebView for both audio and video in the QWebView widget but only for Windows platforms.

I will try a web search to see if there is a workaround for and if so try to incorporate it into the next release as well as try to get the bug fix for the media-type in the content.opf backported in time for a Sigil 0.8.6 bug fix release.

Both audio and video should work on Windows in Sigil, they just do not for some reason.

Take care,

Kevin

KevinH 04-05-2015 06:40 PM

Hi Doitsu,

I played around a bit more and found out that Windows seems to need PluginsEnabled set on the QWebView widget to do anything and then a bunch of extra plugins added into Sigil. No where could I find this anyplace in the Qt docs but I did find it via google in just one place.


With the following change to ViewEditors/BookViewPreview.cpp:

Code:

--- BookViewPreview.cpp.orig        2015-04-02 12:20:42.000000000 -0400
+++ BookViewpreview.cpp        2015-04-05 16:04:23.000000000 -0400
@@ -72,6 +72,7 @@
    // Enable our link filter.
    page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
+    page()->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
    CreateContextMenuActions();
    ConnectSignalsToSlots();
 }

And then including all of the Qt5 plugins into Sigil (including audio and mediaservices) I was able to build a version of Sigil on my Win32 that will nicely play your audio epub.

My video epub would simply not work no matter what. I replaced the sample mp4 video with a small.mp4 video I found on the web and then it worked as well.

So not all mp4 will work but some do. I have no idea why yet.

I will try to get these changes into Sigil 0.8.6 if I can.

Take care,

KevinH

DiapDealer 04-05-2015 09:10 PM

Quote:

Originally Posted by KevinH (Post 3077705)
and then a bunch of extra plugins added into Sigil. No where could I find this anyplace in the Qt docs but I did find it via google in just one place.

Yeah, figuring what Qt plugins are necessary for what (on what platform) is terribly frustrating and underdocumented. Using ldd and setting the QT_DEBUG_PLUGINS environment variable to 1 can be helpful. But getting console output from a gui program on Windows can be its own exercise in futility. ;)

Someone using my linux packages was having issues with "normal" non-US keyboard functionality until I figured out (by sheer trial and error) that one of the platforminputcontexts plugins needed to be included with the package.

Why there can't be a tool that clearly tells you which Qt Libraries and plugins need to be deployed with your application (on the current platform), I'll never know.

KevinH 04-05-2015 10:37 PM

Hi DiapDealer,
I tried the new windeployqt.exe that comes with the latest Qt5.4 for Windows on Sigil.exe just built on Win32 and it never even seemed to find or include any of the Qt plugins (after building with msvc2013_opengl).

So I think for the next release we should probably include a wider range of plugins on Windows and test with an audio and video epub to at least give them a chance to work on Windows.

Take care,

KevinH

BetterRed 04-05-2015 10:47 PM

Little wonder I was never able to get it working - ended up using InDesign - it was a one off :)

BR

Doitsu 04-06-2015 03:31 AM

@KevinH & DiapDealer: I'm once again impressed by your detective work.

Sherlock Holmes ain't got nothing on you! :D

:thanks:

KevinH 04-07-2015 11:07 AM

Hi Doitsu,

FYI - I now have made a Win 32 build of Sigil with a fix for audio and video tags working in Windows.

I was able to test it and your audio test sample should play out of the box when Sigil 0.8.6 is released. Most mp4 videos will also play out of the box on Windows as well. My particular video test case (butterfly being squashed by apple) contains a QuickTime Text track (for described video?) that is ignored on Linux and Mac but prevents the video from being shown on Windows. As far as I can tell, this is simply a Qt bug that I can do nothing about. I have also fixed the corruption of mp4 media-type info in the opf on Sigil saves.

So you should be good to go when Sigil 0.8.6 comes out (hopefully).

Take care,

KevinH


All times are GMT -4. The time now is 06:08 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.