Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Audio in widget. Anyone had any success?

If anyone knows how to get audio working in a widget / html interactive, please post.


Something as simple as a button on a page that plays a .m4a file would be great

iBook, Mac OS X (10.7.2), iBooks Author

Posted on Jan 30, 2012 4:24 PM

Reply
41 replies

Feb 28, 2012 8:45 AM in response to Jon Walker

UPDATE FOR ANYONE INTERESTED:


For any interested and not already "in the know," it appears the different applications are also "space" sensitive with regard to the Java scripts under discussion here. Basically, my last test included references in the Java scripts to resource files which contained "spaces" in the filenames. Like the initial test described by auralsculpture above which displayed a "case" sensitivity, my Java scripts seem to be "space" sensitine in that they passed internal and external browser previe testing but failed to play the embedded audio resource files on the iPad. I expect this may not be news for those who program regularly with Java, but it was a learning experience for me. (Just an FYI for what it's worth to any other "novice" users reading this topic...)


In any case, I also noted that changing the audio filenames in the Finder (i.e., removing the spaces) before import to the Hype project did not correct the file "attributes" actually read by/used in the Hype application. (I.e., the app still used the embedded file attribute for identifying both the Element resource file name and the default entry in the scene timeline listing.) Worried that this might effect test results for Java scripts modified to match the changed Finder filenames, I decided it best to "fix" this inconsistency. While I suppose this could have been done by either re-compressing the original audio source files to M4A content or using a Finder attributes utility, I simply grabbed the files as a group and copied to a different drive. (Another FYI for wehatever it might be worth...)


Tested the modified widget and found it now worked as describe by auralsculpture in his comments above—i.e., worked correctly in small test projects but not in large ones. As a result, I am planning to send Apple another "Feedback" message. I home others who have also observed this problem will also join in and provide additional feedback. Would also appreciate posting here if any determines the "cut-off" for working/non-working projects or who can associate any other specific cause for these results.


Lastly, I noticed that auralsculpture left the "Autoplay" switch activated and Daniel left the "Controls" option set despite original instructions. So I re-ran the test to see if this made any difference. Could not see any change in results so we can likely assume these settings are non-critical. (Turning off the "Autoplay" feature merely eliminated the Element display warning and the "Controls" setting just removes/makes the already "out of display window" audio test contols invisible.)


User uploaded file

Feb 28, 2012 1:23 PM in response to Jon Walker

Firstly IDs. The example I posted was developed in Hype V1. Custom IDs are a 1.5 addition. Yes, you just write in the "automatically generated" field. I now use the same name as the display name. Note that this ID is case sensitive and spaces are not allowed. These IDs give good access to javascript (which I'm just learning and trying to come to grips with).


When you add media files of any type to Hype, they are copied into the "container" document and ultimately into the resources directory of the widget, so changing the name of the source file will not have any effect. If you need to change the name, better to delete and re-import.

This is NOT quite the case with images, which retain their references until you export. I have had a number of cases where I have altered the image in an external editor, then Hype asks if I want to update the image or retain the original.


Bottom line as far as this forum goes, is that a widget with audio, given the correct file encoding, naming, javascripting and export settings DOES work in iBook, but only in very small iBooks - which is virtually useless at the moment.


Until Apple fixes this, none of us can publish sonified textbooks.

Feb 28, 2012 6:58 PM in response to auralsculpture

Firstly IDs. The example I posted was developed in Hype V1. Custom IDs are a 1.5 addition. Yes, you just write in the "automatically generated" field. I now use the same name as the display name. Note that this ID is case sensitive and spaces are not allowed. These IDs give good access to javascript (which I'm just learning and trying to come to grips with).

Thanks for the more detailed explanation. It worked "like a charm" subject to the current project size restrictions. Tried the


document.getElementById("<paste element ID here>").play();


Java script using the direct Element ID reference rather than the resource filename. In fact, I think I prefer it since it more closely simulates use of the media "Play" button (i.e., further multiple presses of the play button are ignored until the audio file either finishes playback or is paused.)



When you add media files of any type to Hype, they are copied into the "container" document and ultimately into the resources directory of the widget, so changing the name of the source file will not have any effect. If you need to change the name, better to delete and re-import.

Sorry, should have been clearer here. When i said I changed the filename at the Finder level, I was refering to the source file before re-importing to Hype. If the modified file is then imported, it still carries the original internal filename attribute rather than the directory/path filename. Moving the file or use of a Finder attributes utility correctly re-writes the internal attribute so that it matches the directory/path filename within the file.



Bottom line as far as this forum goes, is that a widget with audio, given the correct file encoding, naming, javascripting and export settings DOES work in iBook, but only in very small iBooks - which is virtually useless at the moment.

For your purposes maybe, but not necessarily for mine. Basically, I am more interested in "personal" publishing. That is, all I want to do is create iBooks based on free public domain Science Fiction novels for my own use. In addition, I may wish to create "Quickie" tutorials for use by members of the local MUG. Many of these works may contain online media which I can update line online rather than having to redistribute revised editions of the original document. At this time, this is just something I am considering. As a Mac.com/MobileMe user, I am in the process of trying to decide whether to switch to a new service provider come next July or set up my own personal home server and re-dedicate a 16 TB RAID unit for the storage/serving of personal websites, the storage of photos and multimedia content, as well as, the storage and access of other data shared by my entire family which is scattered across the US from NJ to CA. As a retired person on the high side of 65, I figure this may keep me "off the streets and out of trouble" as I reluctantly kick and scream my way into old age.


User uploaded file

Apr 5, 2012 5:34 AM in response to Jon Walker

Jon,


I have followed this thread with great interest. Thank you for your persistence and detailed posts.


I would like to use the audio widget for a childrens picture book.


Each page has a picture with an optional "click to play" audio file.


Under the current implementation clicking play invokes a new full screen view.


Do you know if I can play audio while remaining on the same page?


....Much like the image gallery widget, where you aren't launched into a separate

page.


Any info would be appreciated...


Thank you

Apr 5, 2012 9:10 AM in response to arthur_mtl

Do you know if I can play audio while remaining on the same page?


....Much like the image gallery widget, where you aren't launched into a separate

page.


Any info would be appreciated...

Unfortunately, the nearest thing I've had any success with is the M4A or M4V Podcast file approach. Both work essentialially the same. In the former, you use GasrageBand to create a podcast (M4A) audio file with a "Press to Play" icon embedded. In the latter, you use QT 7 Pro to embed your "page graphic" into an MOV file which can later be recoded as an M4V (which wastes addition storage space). In both cases, the M4A or M4V file is then embedded on the page in in a "Media" widget with the "Full-screen only" option turned off. The first time the page is opened, the podcast file ("press to play" M4A or "page image" M4V widget displays a "Play" icon over the widget indicateing the picture or widget should be pressed for playback. If/when pressed, the audio then plays and a player control is superimposed over the lower portion of the podcast or page image. Unfortunately, if the picture or image is pressed a second time, it only activates the player control rather than replaying the audio directly. On the bright side, closing and returning to the page seems to re-set the primary icon action in the test "proof" file.


User uploaded file

May 17, 2012 8:13 PM in response to Jon Walker

Hello Jon,


Recently I have been trying to add audio to a html widget for my book.


I have read through this post and found a lot of great information.


Do you know if there has been any update on this?


It seems that I have been able to import .m4a audio without a problem inserting the widget into the book, but it still will not play.


some sort of auto play function would be ideal but even a button would be great. The book im working on will be a pretty big file probably a few hundred MB so I was wondering if there still seems to be an issue with large books not playing audio.


Any new information or insights would be really helpful.


Thanks

Jan 24, 2013 5:54 PM in response to tk0us

is it possible to add audio tracks to an ibook page and have it continue playing when another page is selected? i have successfully embedded a media widget on a page in iBA but i want it to continue until the audio clip either ends or is paused by the user. the idea is to be able to listen to the embedded audio [in my case music tracks] while you browse the ibook regardless of which page you are on. any help with this would be much appreciated!

Mar 12, 2013 12:56 PM in response to tk0us

The issue is the size of the iba file. What you say is true until the iba file exceeds about 60 Mbytes. In a large iba file, Keynote audio stops playing and audio in my (custom) HTML widget stops playing. These same widgets work in a small book (small iba file) but quit as the iba file gets larger. This is 100% reproducable and I have reported it as a bug, but don't know when it will be fixed.

Jul 2, 2013 10:25 PM in response to auralsculpture

Here's my experience with it. The size of the file did not affect playback (I created an iba file over 100Mb to make sure my widgets would work). However, some iba files wouldn't play audio even with nothing but the same widget inserted into the bare template. I noticed that all my widgets stopped working when I saved a copy of my book under a different name, so I changed the file name yet again, and they started working just fine. I haven't tried enough tests to be sure, but file names with spaces would not play audio while those without would. I only tested a few files, so that just might be coincidence, but if you have a book where they won't play, try changing the file name once or twice and see if it works for you.

Audio in widget. Anyone had any success?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.