wangrong
2025-03-19 291afb9c81aae1d15d9e3edcea618d0a2e1fc5a6
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background-color: #f5f5f5;
            font-family: Arial, sans-serif;
        }
 
        .container {
            position:absolute;
            top: 0;
            text-align: left;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
            padding: 20px;
            max-width: 1280px;
            width: 100%;
        }
        .dplayer-container {
            display: flex;
        }
 
        .box {
            width: 50%;
            padding: 5px;
            padding-bottom: 20px;
            border: 1px solid #ccc;
            width: 640px;
            height: 360px;
            margin-bottom: 5px;
            text-align: center;
        }
        .box_title {
            color: blue;
        }
 
        img {
            width: 200px;
            height: 100px;
            margin: 2px;
        }
 
        table {
            font-family: Arial, sans-serif;
            border-collapse: collapse;
            width: 100%;
        }
 
        th, td {
            border: 1px solid #dddddd;
            text-align: left;
            padding: 8px;
        }
 
        th {
            background-color: #f2f2f2;
        }
    </style>
    <title>Behaviour Analysis(short as BA) Sample</title>
</head>
<body>
    <div class="container">
        <h2>Behaviour Analysis(short as BA) Sample Based On VideoPipe</h2>
        <div class="dplayer-container">
            <div class="box">
                <div id="dplayer-container-0"></div>
                <div class="box_title">【Channel 0】{{live_stream_0}}</div>
            </div>
            <div class="box">
                <div id="dplayer-container-1"></div>
                <div class="box_title">【Channel 1】{{live_stream_1}}</div>
            </div>
        </div>
        <p class="centered-text">There are <span style="color:red">{{total_records}} BA records</span>. You can filter them by properties:</p>
        <p>
            <form action="/" method="post">
                <label for="channel">Select Channels:</label>
                <select id="channel" name="select_channel" required>
                    <option value="all" {% if select_channel == 'all' %} selected {% endif %}>All Channels</option>
                    <option value="0" {% if select_channel == '0' %} selected {% endif %}>Channel 0</option>
                    <option value="1" {% if select_channel == '1' %} selected {% endif %}>Channel 1</option>
                </select>
                
                <label for="ba_type">Select Ba Types:</label>
                <select id="ba_type" name="select_ba_type" required>
                    <option value="all" {% if select_ba_type == 'all' %} selected {% endif %}>All Types</option>
                    <option value="cross line" {% if select_ba_type == 'cross line' %} selected {% endif %}>Cross Line</option>
                    <option value="stop" {% if select_ba_type == 'stop' %} selected {% endif %}>Stop</option>
                </select>
 
                <label for="ba_type">Select Time Period:</label>
                <input type="datetime-local" id="start_time" name="select_start_time" value="{{select_start_time}}">
                <input type="datetime-local" id="end_time" name="select_end_time"  value="{{select_end_time}}">
                
                <button type="submit">Search</button>
            </form>
        </p>
        <table>
            <thead>
                <tr>
                    <th>uid</th>
                    <th>time</th>
                    <th>channel</th>
                    <th>ba_label</th>
                    <th>target_ids</th>
                    <th>target_properties</th>
                    <th>vertexs_of_region</th>
                    <th>ba_image</th>
                    <th>ba_video</th>
                </tr>
            </thead>
            <tbody>
                {% for result in ba_results: %}
                    <tr>
                        <td>{{result['uid']}}</td>
                        <td>{{result['time']}}</td>
                        <td>{{result['channel']}}</td>
                        <td>{{result['ba_label']}}</td>
                        <td>{{result['involve_targets']}}</td>
                        <td>{{result['properties_of_involve_targets']}}</td>
                        <td>{{result['involve_region']}}</td>
                        {% if result['ba_image'] != '' %}
                            <td><a href="{{result['ba_image']}}"><img src="{{result['ba_image']}}" title="click to load image"></a></td>
                        {% endif %}
                        {% if result['ba_image'] == '' %}
                            <td>no image recorded</td>
                        {% endif %}   
 
                        {% if result['ba_video'] != '' %}
                            <td><a href="{{result['ba_video']}}">click to load video</a></td>
                        {% endif %}   
                        {% if result['ba_video'] == '' %}
                            <td>no video recorded</td>
                        {% endif %}
                    </tr>
                {% endfor%}
            </tbody>
        </table>
    </div>
    <script src="../static/dist/flv.min.js"></script>
    <script src="../static/dist/DPlayer.min.js"></script>
    <script>
        // live stream of channel 0
        const dp_0= new DPlayer({
            container: document.getElementById('dplayer-container-0'),
            live: true,
            autoplay: true,
            mutex: false,
            volume:0,
            video: {
                url: '{{live_stream_0 | safe}}',
                type: 'auto',
            },
        });
        // live stream of channel 1
        const dp_1 = new DPlayer({
            container: document.getElementById('dplayer-container-1'),
            live: true,
            autoplay: true,
            mutex: false,
            volume:0,
            video: {
                url: '{{live_stream_1 | safe}}',
                type: 'auto',
            },
        });
    </script>
</body>
</html>