绍兴公厕前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
2.2 KiB

3 years ago
  1. var PlayerControl = function (a) {
  2. this.wsURL = a.wsURL, this.rtspURL = a.rtspURL, this.ws = null, this.decodeMode = a.decodeMode, this.events = {
  3. ResolutionChanged: function () {
  4. }, PlayStart: function () {
  5. }, DecodeStart: function () {
  6. }, UpdateCanvas: function () {
  7. }, GetFrameRate: function () {
  8. }, FrameTypeChange: function () {
  9. }, Error: function () {
  10. }, MSEResolutionChanged: function () {
  11. }, audioChange: function () {
  12. }, WorkerReady: function () {
  13. }, IvsDraw: function () {
  14. }, FileOver: function () {
  15. }
  16. }, this.username = a.username, this.password = a.password
  17. };
  18. PlayerControl.prototype = {
  19. init: function (a, b) {
  20. this.ws = new WebsocketServer(this.wsURL, this.rtspURL), this.ws.init(a, b), this.ws.setLiveMode(this.decodeMode), this.ws.setUserInfo(this.username, this.password);
  21. for (var c in this.events) this.ws.setCallback(c, this.events[c]);
  22. this.events = null
  23. }, connect: function () {
  24. this.ws.connect()
  25. }, play: function () {
  26. this.controlPlayer("PLAY")
  27. }, pause: function () {
  28. this.controlPlayer("PAUSE")
  29. }, stop: function () {
  30. this.controlPlayer("TEARDOWN")
  31. }, close: function () {
  32. this.ws.disconnect()
  33. }, playByTime: function (a) {
  34. this.controlPlayer("PLAY", "video", a)
  35. }, playFF: function (a) {
  36. this.controlPlayer("PAUSE"), this.controlPlayer("SCALE", a)
  37. }, playRewind: function () {
  38. }, audioPlay: function () {
  39. this.controlPlayer("audioPlay", "start")
  40. }, audioStop: function () {
  41. this.controlPlayer("audioPlay", "stop")
  42. }, setAudioSamplingRate: function (a) {
  43. this.controlPlayer("audioSamplingRate", a)
  44. }, setAudioVolume: function (a) {
  45. this.controlPlayer("volumn", a)
  46. }, controlPlayer: function (a, b, c) {
  47. var d;
  48. d = "video" === b ? {command: a, range: c ? c : 0} : {command: a, data: b}, this.ws.controlPlayer(d)
  49. }, setPlayMode: function (a) {
  50. this.ws.setLiveMode(a)
  51. }, setPlayPath: function (a) {
  52. this.ws.setRTSPURL(a)
  53. }, capture: function (a) {
  54. this.ws.capture(a)
  55. }, on: function (a, b) {
  56. this.events[a] = b
  57. }
  58. };