shuishen
2022-07-29 71ac571768baab6ca36057be77075b80cfe74739
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
 
$(function () {
 
    function realStartVideo(dom, url) {
        if (Hls.isSupported()) {
            dom.volume = 1.0;
            var hls = new Hls();
            var m3u8Url = decodeURIComponent(url)
            hls.loadSource(m3u8Url);
            hls.attachMedia(dom);
            hls.on(Hls.Events.MANIFEST_PARSED, function () {
                dom.play();
            });
        }
    }
 
    var videoCode = getQueryStringByKey("code");
 
    $.ajax({
        type: 'GET',
        url: "http://watermap.ysy.com.cn/onemap/api/v1/camera/newprojectvideos?code=" + videoCode,
        success: function (result) {
 
            var data = result.data;
            
            $('.leaflet-popup-content-wrapper').empty();
 
            if (data.length > 1) {
 
                var ulData = $("<ul class='leaflet-menu-left'></ul>");
                
                for (var i = 0; i < data.length; i++) {
                    ulData.append("<li data-url='"+data[i].url+"'>"+data[i].name+"</li>")
                }
 
                $('.leaflet-popup-content-wrapper').append(ulData);
 
                $('.leaflet-popup-content-wrapper').append("<video class='reals-right-y' src='' muted='muted'></video>");
 
                $('.leaflet-popup-content-wrapper li:eq(0)').addClass('on');
 
                realStartVideo($('.leaflet-popup-content-wrapper video')[0], data[0].url)
 
                $('.leaflet-popup-content-wrapper').off('click', 'li').on('click', 'li', function () {
                    $(this).addClass('on').siblings().removeClass('on');
                    realStartVideo($('.leaflet-popup-content-wrapper video')[0], $(this).attr('data-url'))
                })
 
 
            } else {
 
                $('.leaflet-popup-content-wrapper').append("<video class='real-right-y' src='' muted='muted'></video>");
 
                realStartVideo($('.leaflet-popup-content-wrapper video')[0], data[0].url)
 
            }
 
 
            // upwardMovement($(document.getElementById('EZUIKit_VIDEO')).find('.bubble-window-top')[0], 0, tokenStr);
 
            // towardsTheLeft($(document.getElementById('EZUIKit_VIDEO')).find('.bubble-window-left')[0], 2, tokenStr);
 
            // downward($(document.getElementById('EZUIKit_VIDEO')).find('.bubble-window-bottom')[0], 1, tokenStr);
 
            // towardsTheRight($(document.getElementById('EZUIKit_VIDEO')).find('.bubble-window-right')[0], 3, tokenStr);
 
            // blowUp($(document.getElementById('EZUIKit_VIDEO')).find('.bubble-window-blow-up')[0], 8, tokenStr);
 
            // zoomOut($(document.getElementById('EZUIKit_VIDEO')).find('.bubble-window-zoom-out')[0], 9, tokenStr);
 
        }
    })
 
 
    function getQueryStringByKey(key) {
        return (document.location.search.match(new RegExp("(?:^\\?|&)" + key + "=(.*?)(?=&|$)")) || ['', null])[1];
    }
})