Page 1 of 1

mergAVPlayerCreate Help.

Posted: Mon Apr 17, 2023 8:08 pm
by MxDx
I am using on currentTimeChanged theInterval to sync graphic objects in my app with the playback location of an audio file.
The player object is used for audio playback on Mac OS.
I need to implement this same functionality for the iOS platform.

I'm looking at mergAVPlayerCreate & mergAVPlayerCreatePeriodicTimeObserver to handle this.
#1 Is this the best way to implement it?
I'm still new to LC - the docs on these functions leaves me scratching my head.
#2 Are there any example files I might find somewhere. ( I've yet to find anything)

This is what I have so far - but it doesn't work. ( the path checks out)

Code: Select all

-- Path to the audio file
 01.  put specialFolderPath("engine") & "/Audio Files/myMP3File" into tFilePath   -- myMP3File is a placeholder.
   
   --   -- Create a new AVPlayer object  this line crashes LC
02.   put mergAVPlayerCreate("avPlayer", ) into tPlayerID
   
   -- Set the file path for the player
   set the fileName of player tPlayerID to tFilePath
   
   --   -- Start playing the audio file
 .03  play player tPlayerID[/indent]