VideoException.java 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package org.yczbj.ycvideoplayerlib.tool;
  2. /**
  3. * <pre>
  4. * @author yangchong
  5. * blog : https://github.com/yangchong211
  6. * time : 2018/11/9
  7. * desc : 播放器异常
  8. * revise: 抛出异常并且供开发者快捷查询异常定位代码
  9. * </pre>
  10. */
  11. public class VideoException extends RuntimeException {
  12. private int mCode = 0;
  13. public VideoException(int code, String msg) {
  14. super(msg);
  15. mCode = code;
  16. }
  17. @Deprecated
  18. public VideoException(String msg) {
  19. super(msg);
  20. }
  21. public VideoException(Throwable throwable) {
  22. super(throwable);
  23. if (throwable instanceof VideoException) {
  24. mCode = ((VideoException) throwable).getCode();
  25. }
  26. }
  27. public int getCode() {
  28. return mCode;
  29. }
  30. public String getMsg() {
  31. return getMessage();
  32. }
  33. //自定义RenderView不能设置为null
  34. public static final int CODE_NOT_RENDER_FACTORY = 19;
  35. //PlayerFactory不能设置为null
  36. public static final int CODE_NOT_PLAYER_FACTORY = 20;
  37. //VideoPlayer,需要在start播放前给设置控制器Controller
  38. public static final int CODE_NOT_SET_CONTROLLER = 21;
  39. }