Hi, I'm trying to use the AVAudioPlayer class of U3DXT but after creating a new instance of the AVAudioPlayer and calling Play() I get the following error:
U3DXTException: Cached object (null) is invalid
at U3DXT.iOS.Native.Internals._CallbackCache._ThrowException (System.String str) [0x00000] in :0
at (wrapper native-to-managed) U3DXT.iOS.Native.Internals._CallbackCache:_ThrowException (intptr)
at U3DXT.iOS.Native.AVFoundation.AVAudioPlayer.Play ()
The code that causes this error is as follows :
#pragma strict
import System.IO;
import U3DXT.Core;
import U3DXT.iOS.MediaPlayer;
import U3DXT.iOS.Native.MediaPlayer;
import U3DXT.iOS.Native.Foundation;
import U3DXT.Utils;
import U3DXT.iOS.Native.AVFoundation;
var query : MPMediaQuery;
var mediaItem : MPMediaItem;
var theError : NSError;
var songURL : NSURL;
var theAudioPlayer : AVAudioPlayer;
function Start () {
theError = new NSError();
query = new MPMediaQuery.SongsQuery();
mediaItem = query.items[0] as MPMediaItem;
songURL = new NSURL(mediaItem.PropertyAssetURL);
theAudioPlayer = new AVAudioPlayer(songURL, theError);
theAudioPlayer.Play();
}
//Changing the last two lines to :
theAudioPlayer = new AVAudioPlayer();
Debug.Log("Volume : " + theAudioPlayer.volume);
Results in the following in XCode :
0x17e0e46: vmov d8, r0, r0
↧