• xthis works, might be ways to simplify

    from objc_util import * s=ObjCClass("AVAudioSession").sharedInstance() s.setActive_error_(False,None) s.setCategory_withOptions_error_(ns('AVAudioSessionCategoryPlayback'),0x2,None) # s.setActive_error_(True,None) import sound sp=sound.Player('game:Bleep') sp.play() s.setActive_error_(False,None) s.setCategory_withOptions_error_(ns('AVAudioSessionCategoryPlayback'),0x1,None)

    option 2 means to "duck others". there is another option to interrupt others, but i cant seem to get that working.
    If we dont set active false at the end, the music stays softer.
    Im not entirely sure if the setActive is needed up front.

  • Thanks!
    I made wrong assumptions about the today widget and its implications..
    Running the script directly seems to solve the issues.
    I'll give it a long-term whirl, but it looks like it works fine.
    Thanks again for your time and insight.
    Massimo

  • I think just keeping the iPad active will be enough. I don't really need it to run in the background. Thanks!

  • IOS applications can register to recieve "notifications" of certain system events.Since pythonista has a bridge to objectivec, it is possible to tap into those events, and register a python function to be called when the event occurs.

    This code probably needs to handle cleared globals, and multiple runs ("deregister" the object), etc but would work for the simple use case presented.

  • Note to self (and others so afflicted)—
    Starting with this seemed to fix it:
    set_fill_color(1.0,1.0,1.0)
    fill_rect(0,0,scrSize[0],scrSize[1])

    where i've done this at global scope:
    scrSize=(1136,640) # iPhone 5
    set_size(*scrSize) # min 16, max 2048

    (my canvas is meant for landscape viewing)

Internal error.

Oops! Looks like something went wrong!