NIMSDK-AOS  9.16.0
QChatMediaVideoParams.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.qcmedia.model;
2 
3 import android.text.TextUtils;
4 import org.json.JSONObject;
5 
6 public class QChatMediaVideoParams {
7 
11  private int width;
15  private int height;
19  private int fps;
20 
21 
23  }
24 
31  public QChatMediaVideoParams(int width, int height, int fps) {
32  this.width = width;
33  this.height = height;
34  this.fps = fps;
35  }
36 
37 
38  public int getWidth() {
39  return width;
40  }
41 
42  public void setWidth(int width) {
43  this.width = width;
44  }
45 
46  public int getHeight() {
47  return height;
48  }
49 
50  public void setHeight(int height) {
51  this.height = height;
52  }
53 
54  public int getFps() {
55  return fps;
56  }
57 
58  public void setFps(int fps) {
59  this.fps = fps;
60  }
61 
62  public String toJson(){
63  try {
64  JSONObject jsonObject = new JSONObject();
65  jsonObject.put("width",getWidth());
66  jsonObject.put("height",getHeight());
67  jsonObject.put("fps",getFps());
68  return jsonObject.toString();
69  } catch (Exception e) {
70  e.printStackTrace();
71  }
72  return null;
73  }
74 
75  public static QChatMediaVideoParams fromJson(String json){
76  QChatMediaVideoParams model = null;
77  if(!TextUtils.isEmpty(json)){
78  try {
79  JSONObject jsonObject = new JSONObject(json);
80  model = new QChatMediaVideoParams();
81  model.setWidth(jsonObject.optInt("width"));
82  model.setHeight(jsonObject.optInt("height"));
83  model.setFps(jsonObject.optInt("fps"));
84  } catch (Exception e) {
85  e.printStackTrace();
86  }
87  }
88  return model;
89  }
90 }