Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Oops – chopped a bit off at the end somehow, I think:

    jQuery(elem).parent().find(‘.wpaudio-position’).text(time_string + ‘/’ + time_string1);

    Hi … is this what you want:
    https://www.xarta.co.uk/TESTWP/

    I’ve spent a good few hours studying the code and learning about the relevant technologies – so when I saw your problem I thought to myself – now this is easy peasy. ??

    If you find the //set time part in the non-minified code, you can just add a bit to show all the times as I have done below – but you’ll have to re-minify the code, or just rename the minified js file to “old” or something, and for now change the non-minified js file and rename it (a lie) to the minified js file name.

    // Set time
    		var min = Math.floor(info.position / 60);
    		var sec = Math.floor(info.position % 60);
    		var time_string = min + ':';
    		if ( sec < 10 ) {
    			time_string += '0'; // Add leading 0 to seconds if necessary
    		}
    		time_string += sec;
    
    		var min1 = Math.floor(info.duration / 60);
    		var sec1 = Math.floor(info.duration % 60);
    		var time_string1 = min1 + ':';
    		if ( sec1 < 10 ) {
    			time_string1 += '0'; // Add leading 0 to seconds if necessary
    		}
    		time_string1 += sec1;
    
    		jQuery(elem).parent().find('.wpaudio-position').text(time_string + '/' + time_string1);

    Hope that helps

    Best wishes

    Dave

    Thread Starter davros1973

    (@davros1973)

    Ok – I get confused real-easy … and I don’t really know what I’m doing … but changing the above to below seems to have done the trick for me. I think it must be to do with states of the audio thingy in html5, and when the attribute is accessed … so I’ve just split up the try/catch structure for the attributes … and this seems to have done the trip for me.

    var getInfo = function () {
    var pos, dur, start, end;
    try {
    pos = player.currentTime;
    }
    catch (e) {
    pos = 0;
    }
    try {
    dur = player.duration;
    }
    catch (e) {
    dur = 0;
    }
    try {
    start = player.seekable.start();
    }
    catch (e) {
    start = 0;
    }
    try {
    end = player.seekable.end();
    }
    catch (e) {
    end = 0;
    }
    return {
    is_playing: isPlaying(),
    position: pos,
    duration: dur,
    playable_start: start,
    playable_end: end
    };

    Thread Starter davros1973

    (@davros1973)

    Grrr – I still didn’t get it!

    Going on about NaN – well that was just because it wasn’t known at the start apparently.

    Anyway – gone back to getInfo in function WpaudioHTML5 (parent) … and now I know player.seekable.start and player.seekable.end cause the error … actually player.currentTime and I think player.Duration work just fine in IE9. And on with the investigation. I’m having to study JavaScript and JQuery and HTML 5 as I go along. Still find it hard to get my head around JavaScript functions (as first class citizens so to speak) and call back functions. I get confused easily.

    var getInfo = function () {
    var pos, dur, start, end;
    try {
    pos = player.currentTime;
    dur = player.duration;
    start = player.seekable.start();
    end = player.seekable.end();
    }
    catch (e) {
    pos = 0;
    dur = 0;
    start = 0;
    end = 0;
    }
    return {
    is_playing: isPlaying(),
    position: pos,
    duration: dur,
    playable_start: start,
    playable_end: end
    };
    };
    this.getInfo = getInfo;

    Thread Starter davros1973

    (@davros1973)

    I’m such an idiot. I must have pressed compatability view in ie9 at some stage (or before I upgraded from ie8) – which got remembered I guess and that’s why the browser going into ie7 standards mode confused me (I’ve refreshed myself on doctype and standards/quirks modes and all that now – though it’s so complicated as to what is actually used depending on circumstance that it makes my head spin). And I’m more familiar with the new IE9 interface.

    Anyway – I think I understand what’s going on now with the plug-in “not working”. Basically, on ie8 and less, and firefox 4, and 3.x and so on, and opera, the plugin was falling back on to flash.

    Firefox doesn’t even play mp3’s in html5 audio!

    But safari and chrome do (webkit) – and they work fine.

    Along comes Internet Explorer 9 – it has html5 audio tag working – and it plays mp3’s … so the plug in tries to do that. But for some reason, and I presume at this point it’s an IE9 support issue, the .currentTime, Duration and so on IDL attributes don’t seem to populate properly. Well – currentTime comes back as 0 at the start, but Duration as NaN (Not A Number) – that’s all I tested in IE9.

    So I guess, for now, not really knowing what I’m doing, I’ll detect IE9 using a conditional comment (safe-supposedly) and force IE9 to fallback onto Flash for now. Really I suppose I should detect flash (or its absence) and force html5 audio even though it doesn’t work “properly” (for my needs) if flash isn’t available.

    Hey ho.

    Thread Starter davros1973

    (@davros1973)

    Ok – I don’t get it.

    Goto this site in IE9 – and it opens in ie9/standards mode etc.
    https://2010dev.wordpress.com/2010/02/02/valid-html5/

    But on my test site … completely clean … removing everything else completely except the wpaudio plugin folder (but deactivating it at least [not removing options from mysql or anything]) … clicking to it makes ie9 go into compat/ie7-mode.

    So is that something to do with Word Press 3.1? Or my installation?
    It’s all very very confusing.

    And anyway – still seem to have that pesky problem with wpaudio plugin on wordpress 3.1 in ie9 standards mode.

    If anyone can help me understand all this – much appreciated.

    I think I’ll look for blogs with twenty-ten, using wordpress 3.1 and see what they do in ie9.

    Thread Starter davros1973

    (@davros1973)

    Ahhh – when I click on the link from this forum, in ie9, to my the-icons site … the doctype is the xhmtl transitional (it’s stated etc. in the theme I started-off with) … but the twenty-ten standard theme has doctype “html” only.

    ie9 goes into browser compatability view, browser-mode-ie7, when confronted with that doctype (and the plugin then works of course under those conditions). That’s why I got a bit confused before.

    If I force ie9 backinto ie9 mode etc. then the problem is there even on the clean-install.

    Thread Starter davros1973

    (@davros1973)

    Ok – me again – I do seem to have a problem.

    I made a brand-spanking-new standard install of wordpress:
    https://www.xarta.co.uk/TESTWP/
    … only plug-in wpaudio … only change made in settings was to check the box to change all mp3 links etc.

    And I inserted a local mp3 file into the hello world post.

    IE9 – document standard thingy … still problem with updating the time-count and bar-position … though so far I’ve traced-backwards to GetInfo() (from the audio object thingy) not working.

    I might try forcing the flash fall back … maybe it has something to do with document types or something.

    I got confused before – I think the pages that seemed to work with wpaudio on ie9 that I found might be using the flash fallback – though I get confused easily so i don’t really know for sure.

    Thread Starter davros1973

    (@davros1973)

    Oh – oops – might be something I did – found a couple of sites that work no problem! Please ignore my earlier post made in haste!

Viewing 9 replies - 1 through 9 (of 9 total)