O'Reilly logo

NativeScript for Angular Mobile Development by Nathanael J. Anderson, Nathan Walker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using NativeScript's strengths by tapping directly into the native API of the underlying iOS AVAudioPlayer instance from the nativescript-audio plugin

Let's insert some safeguards into our play/pause logic to help ensure our tracks stay in sync to the best of our programming abilities. The nativescript-audio plugin offers an iOS-only method called playAtTime. It works in tandem with the special deviceCurrentTime property, as described in Apple's documentation for this very purpose at https://developer.apple.com/reference/avfoundation/avaudioplayer/1387462-devicecurrenttime? language=objc.

Since deviceCurrentTime is not exposed by the nativescript-audio plugin, we can access the native property directly via the ios getter. Let's adjust the  ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required