一、Android
获取配置
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext);
int boSupportCache = sp.getInt("ZybPlayerCacheSwith",1);
int boMediaCodec = sp.getInt("ZybPlayerMediaCodec",1);
int boDnsPod = sp.getInt("ZybPlayerDnsPod",1);
书写配置
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext);
SharedPreferences.Editor editor = sp.edit();//获取编辑器
editor.putInt("ZybPlayerCacheSwith",chache);
editor.putInt("ZybPlayerMediaCodec",hw);
//int boDnsPod = sp.getInt("ZybPlayerDnsPod",1);
editor.commit();//提交修改
参考:
https://www.cnblogs.com/huangjie123/p/5962389.html
二、IOS配置
添加配置
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setBool:boCache forKey:@"ZybPlayerCacheSwith"];
[defaults setBool:boMediaCodec forKey:@"ZybPlayerMediaCodec"];
[defaults synchronize];
获取配置
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
bool boSupportCache = [defaults objectForKey:@"ZybPlayerCacheSwith"];
bool boMediaCodec = [defaults objectForKey:@"ZybPlayerMediaCodec"];
参考:
https://blog.csdn.net/ah200614435/article/details/7869681