private void CleanupConfig() { if (_dzConfig != null) { Logger.LogTrace("DeezerRenderer::CleanupConfig => Cleaning up config ..."); _dzConfig = null; } }
public DZConnection(dz_connect_configuration config) { Handle = dz_connect_new(ref config); Active = false; if (Handle.ToInt32() == 0) { throw new ConnectionInitFailedException("Connection handle failed to initialize. Check connection info you gave"); } }
private void SetupConfig() { if (_dzConfig == null) { Logger.LogTrace("DeezerRenderer::SetupConfig => Creating config object ..."); _dzConfig = new dz_connect_configuration(); _dzConfig.app_id = ProTONEConfig.DeezerApplicationId; _dzConfig.product_id = ApplicationInfo.ApplicationName; _dzConfig.product_build_id = SuiteVersion.Version; _dzConfig.user_profile_path = USER_CACHE_PATH; // TODO SET THE USER CACHE PATH _dzConfig.connect_event_cb = new dz_connect_onevent_cb(OnApplicationConnectEvent); _dzConfig.app_has_crashed_delegate = new dz_connect_crash_reporting_delegate(OnAppCrashed); } }
void Awake() { Debug.Log(Screen.currentResolution.width + "x" + Screen.currentResolution.height); //contentLink = "track/10287076"; //contentLink = "album/607845"; // contentLink = "playlist/1363560485"; // FIXME: choose your content here string userAccessToken = "fr49mph7tV4KY3ukISkFHQysRpdCEbzb958dB320pM15OpFsQs"; string userApplicationid = "190262"; string userApplicationName = "UnityPlayer"; string userApplicationVersion = "00001"; // TODO: system-wise cache path #if UNITY_STANDALONE_WIN string userCachePath = "c:\\dzr\\dzrcache_NDK_SAMPLE"; #else string userCachePath = "/var/tmp/dzrcache_NDK_SAMPLE"; #endif dz_connect_configuration config = new dz_connect_configuration( userApplicationid, userApplicationName, userApplicationVersion, userCachePath, ConnectionOnEventCallback, IntPtr.Zero, null ); IndexInPlaylist = 0; Connection = new DZConnection(config); GCHandle selfHandle = GCHandle.Alloc(this); SelfPtr = GCHandle.ToIntPtr(selfHandle); Player = new DZPlayer(Connection.Handle); Connection.Activate(SelfPtr); Player.Activate(SelfPtr); Player.SetEventCallback(PlayerOnEventCallback); Connection.CachePathSet(config.user_profile_path); Connection.SetAccessToken(userAccessToken); Connection.SetOfflineMode(false); }
[DllImport(DZImport.LibPath)] public static extern IntPtr dz_connect_new(ref dz_connect_configuration config);