| File was renamed from src/main/resources/public/js/history/historypler.js |
| | |
| | | ;!(function () { |
| | | |
| | | |
| | | |
| | | function Historypler(opt) { |
| | | function HistoryComponent(opt) { |
| | | if (typeof opt.elem === 'string') { |
| | | opt.elem = document.getElementById(opt.elem); |
| | | } |
| | |
| | | appendContent(this.elem); |
| | | |
| | | let stream_path; |
| | | let ffurl = opt.ffurl; |
| | | let code = opt.code; |
| | | let cameraId = opt.cameraId; |
| | | |
| | | let container = document.getElementById("container"); |
| | | |
| | | let h5lc = new Jessibuca({container, decoder: ffurl, videoBuffer: 0}); |
| | | let h5lc = new Jessibuca({container, decoder: "js/jessibuca/ff.js", videoBuffer: 0}); |
| | | |
| | | let hourTimestamp = 3600 * 1000; |
| | | let dayTimestamp = hourTimestamp * 24; |
| | |
| | | |
| | | //播放 |
| | | $(".progressTime-left-b-start").on("click", function () { |
| | | historypler.playVideo(code,currentTimer,function (result) { |
| | | h5lc.onLoad = function () { |
| | | this.play(result.jessicaURL); |
| | | } |
| | | if (opt.rtspUrl){ |
| | | let rtspUrl = opt.rtspUrl; |
| | | historyComponent.playVideoRTSP(rtspUrl,currentTimer,function (result) { |
| | | h5lc.play(result.jessicaURL) |
| | | }); |
| | | }else { |
| | | historyComponent.playVideo(cameraId,currentTimer,function (result) { |
| | | h5lc.play(result.jessicaURL) |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | let than = this; |
| | |
| | | $(".progressTime-left-b-start stop").on("click", function () { |
| | | $(this).removeClass("stop"); |
| | | h5lc.destroy(); |
| | | than.closeVideo(stream_path) |
| | | than.closeVideo(stream_path); |
| | | than.elem.style.display = 'none'; |
| | | }); |
| | | |
| | |
| | | element.innerHTML = _content; |
| | | } |
| | | |
| | | //播放 |
| | | Historypler.prototype.playVideo = function (video_id,starttime, callback) { |
| | | //播放 - 针对摄像头id |
| | | HistoryComponent.prototype.playVideo = function (video_id,starttime, callback) { |
| | | $.ajax({ |
| | | type: "get", |
| | | //url: "../../webapi/media/live?param=" + video_id, |
| | | url: "../../monica/history?param=" + video_id+ "&startTime=" + starttime, |
| | | url: "../../webapi/media/historical?param=" + video_id+ "&startTime=" + starttime+"&endTime=", |
| | | timeout: 5000, |
| | | async: false, |
| | | success: function (result) { |
| | | callback(result); |
| | | } |
| | | }); |
| | | }; |
| | | //播放 - 针对rtsp |
| | | HistoryComponent.prototype.playVideoRTSP = function (rtspURL,starttime, callback) { |
| | | $.ajax({ |
| | | type: "get", |
| | | url: "../../webapi/media/rtsp/historical?param=" + rtspURL+ "&startTime=" + starttime+"&endTime=", |
| | | timeout: 5000, |
| | | async: false, |
| | | success: function (result) { |
| | |
| | | }; |
| | | |
| | | //关闭流 |
| | | Historypler.prototype.closeVideo = function (streamPath) { |
| | | HistoryComponent.prototype.closeVideo = function (streamPath) { |
| | | if (streamPath && typeof streamPath === "string") { |
| | | $.ajax({ |
| | | type: "get", |
| | | //url: "../../webapi/media/stop?param=" + streamPath, |
| | | url: "../../monica/stop?param=" + streamPath, |
| | | url: "../../webapi/media/stop?param=" + streamPath, |
| | | async: false, |
| | | success: function (result) { |
| | | } |
| | |
| | | } |
| | | }; |
| | | |
| | | Historypler.prototype.close = function () { |
| | | HistoryComponent.prototype.close = function () { |
| | | this.closeVideo(this.stream_path); |
| | | }; |
| | | |
| | | window.Historypler = Historypler; |
| | | window.HistoryComponent = HistoryComponent; |
| | | |
| | | })() |
| | | |