一隘击、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