NIMSDK-AOS  9.16.0
QChatMediaAudioQuality.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.qcmedia.model;
2 
3 import android.text.TextUtils;
6 import org.json.JSONObject;
7 
8 public class QChatMediaAudioQuality {
9 
10  private QChatMediaAudioProfile profile;
11  private QChatMediaAudioScenario scenario;
12 
14  }
15 
17  this.profile = profile;
18  this.scenario = scenario;
19  }
20 
22  return profile;
23  }
24 
25  public void setProfile(QChatMediaAudioProfile profile) {
26  this.profile = profile;
27  }
28 
30  return scenario;
31  }
32 
33  public void setScenario(QChatMediaAudioScenario scenario) {
34  this.scenario = scenario;
35  }
36 
37  public String toJson(){
38  try {
39  JSONObject jsonObject = new JSONObject();
40  jsonObject.put("profile",profile.name());
41  jsonObject.put("scenario",scenario.name());
42  return jsonObject.toString();
43  } catch (Exception e) {
44  e.printStackTrace();
45  }
46 
47  return null;
48  }
49 
50  public static QChatMediaAudioQuality fromJson(String json){
51  QChatMediaAudioQuality model = null;
52  if(!TextUtils.isEmpty(json)){
53  try {
54  JSONObject jsonObject = new JSONObject(json);
55  model = new QChatMediaAudioQuality();
56  model.setProfile(QChatMediaAudioProfile.valueOf(jsonObject.getString("profile")));
57  model.setScenario(QChatMediaAudioScenario.valueOf(jsonObject.getString("scenario")));
58  } catch (Exception e) {
59  e.printStackTrace();
60  }
61  }
62 
63  return model;
64  }
65 }
QChatMediaAudioQuality(QChatMediaAudioProfile profile, QChatMediaAudioScenario scenario)