Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
L
luna
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
luna
Commits
c026b578
Commit
c026b578
authored
Sep 11, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 优化录像播放
parent
6993e7a8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
111 additions
and
97 deletions
+111
-97
proxy.conf.json
proxy.conf.json
+4
-0
app.service.ts
src/app/app.service.ts
+0
-4
asset-tree.component.ts
src/app/elements/asset-tree/asset-tree.component.ts
+1
-1
guacamole.component.html
src/app/pages/replay/guacamole/guacamole.component.html
+18
-17
guacamole.component.scss
src/app/pages/replay/guacamole/guacamole.component.scss
+59
-50
guacamole.component.ts
src/app/pages/replay/guacamole/guacamole.component.ts
+13
-5
replay.component.ts
src/app/pages/replay/replay.component.ts
+15
-19
router.module.ts
src/app/router/router.module.ts
+1
-1
No files found.
proxy.conf.json
View file @
c026b578
...
...
@@ -28,6 +28,10 @@
},
"secure"
:
false
},
"/media/"
:
{
"target"
:
"http://127.0.0.1:8080"
,
"secure"
:
false
},
"/guacamole/"
:
{
"target"
:
"http://127.0.0.1:8083"
,
"secure"
:
false
,
...
...
src/app/app.service.ts
View file @
c026b578
...
...
@@ -91,10 +91,6 @@ export class HttpService {
return
this
.
http
.
get
<
Array
<
SystemUser
>>
(
url
);
}
refreshMyGrantedNodes
()
{
return
this
.
http
.
get
<
Array
<
TreeNode
>>
(
'/api/perms/v1/user/nodes-assets/tree/?cache_policy=2'
);
}
getGuacamoleToken
(
user_id
:
string
,
authToken
:
string
)
{
const
body
=
new
HttpParams
()
.
set
(
'username'
,
user_id
)
...
...
src/app/elements/asset-tree/asset-tree.component.ts
View file @
c026b578
...
...
@@ -93,7 +93,7 @@ export class ElementAssetTreeComponent implements OnInit, OnDestroy {
if
(
this
.
_navSvc
.
treeLoadAsync
)
{
setting
[
'async'
]
=
{
enable
:
true
,
url
:
'/api/perms/v1/users/nodes/children-with-assets/tree/'
,
url
:
'/api/perms/v1/users/nodes/children-with-assets/tree/
?cache_policy=1
'
,
autoParam
:
[
'id=key'
,
'name=n'
,
'level=lv'
],
type
:
'get'
};
...
...
src/app/pages/replay/guacamole/guacamole.component.html
View file @
c026b578
<div
id=
"player"
>
<div
class=
"controls"
>
<button
id=
"play-pause"
class=
"btn"
(
click
)="
toggle
()"
>
<i
class=
"fa"
[
ngClass
]="{'
fa-play
'
:
!
isPlaying
,'
fa-pause
'
:
isPlaying
}"
></i>
</button>
<button
type=
"button"
class=
"btn"
(
click
)="
restart
()"
>
<i
class=
"fa fa-repeat"
aria-hidden=
"true"
></i>
</button>
<input
id=
"position-slider"
type=
"range"
[(
ngModel
)]="
percent
"
[
attr
.
max
]="
max
"
(
mouseup
)="
runFrom
()"
>
<span
id=
"position"
>
{{ position }}
</span>
<span>
/
</span>
<span
id=
"duration"
>
{{ duration }}
</span>
<button
id=
"play-pause"
class=
"btn"
(
click
)="
toggle
()"
>
<i
class=
"fa"
[
ngClass
]="{'
fa-play
'
:
!
isPlaying
,'
fa-pause
'
:
isPlaying
}"
></i>
</button>
<button
type=
"button"
class=
"btn"
(
click
)="
restart
()"
>
<i
class=
"fa fa-repeat"
aria-hidden=
"true"
></i>
</button>
<input
id=
"position-slider"
type=
"range"
[(
ngModel
)]="
percent
"
[
attr
.
max
]="
max
"
(
mouseup
)="
runFrom
()"
>
<span
id=
"position"
>
{{ position }}
</span>
<span>
/
</span>
<span
id=
"duration"
>
{{ duration }}
</span>
</div>
<div
id=
"display"
(
click
)="
toggle
()"
>
<div
class=
"notification-container"
>
<div
class=
"seek-notification"
>
<p>
Seek in progress...
<button
id=
"cancel-seek"
class=
"btn"
(
click
)="
cancelSeek
($
event
)"
>
Cancel
</button>
</p>
</div>
<div
class=
"notification-container"
>
<div
class=
"seek-notification"
>
<p>
Seek in progress...
<button
id=
"cancel-seek"
class=
"btn"
(
click
)="
cancelSeek
($
event
)"
>
Cancel
</button>
</p>
</div>
</div>
<div
id=
"screen"
></div>
</div>
</div>
src/app/pages/replay/guacamole/guacamole.component.scss
View file @
c026b578
#player
{
width
:
800px
;
width
:
100%
;
height
:
100%
;
padding
:
5px
;
}
#display
{
position
:
relative
;
position
:
relative
;
width
:
calc
(
100vw
-
10px
);
height
:
calc
(
100vh
-
40px
);
}
#screen
*
{
}
#player
.notification-container
{
position
:
absolute
;
z-index
:
1
;
top
:
0
;
right
:
0
;
left
:
0
;
bottom
:
0
;
position
:
absolute
;
z-index
:
1
;
top
:
0
;
right
:
0
;
left
:
0
;
bottom
:
0
;
}
#player
.seek-notification
{
color
:
white
;
background
:
rgba
(
0
,
0
,
0
,
0
.75
);
color
:
white
;
background
:
rgba
(
0
,
0
,
0
,
0
.75
);
display
:
none
;
/* Initially hidden */
width
:
100%
;
height
:
100%
;
display
:
none
;
/* Initially hidden */
width
:
100%
;
height
:
100%
;
}
#player
.seeking
.seek-notification
{
display
:
table
;
display
:
table
;
}
#player
.seek-notification
p
{
display
:
table-cell
;
text-align
:
center
;
vertical-align
:
middle
;
font-family
:
sans-serif
;
display
:
table-cell
;
text-align
:
center
;
vertical-align
:
middle
;
font-family
:
sans-serif
;
}
#player
.controls
{
width
:
100%
;
width
:
100%
;
height
:
30px
;
/* IE10 */
display
:
-
ms-flexbox
;
-ms-flex-align
:
center
;
-ms-flex-direction
:
row
;
/* IE10
*/
display
:
-
ms-flex
box
;
-ms-fle
x-align
:
center
;
-ms-flex-direction
:
row
;
/* Ancient Mozilla
*/
display
:
-
moz-
box
;
-moz-bo
x-align
:
center
;
-moz-box-orient
:
horizontal
;
/* Ancient Mozilla
*/
display
:
-
moz
-box
;
-moz
-box-align
:
center
;
-moz
-box-orient
:
horizontal
;
/* Ancient WebKit
*/
display
:
-
webkit
-box
;
-webkit
-box-align
:
center
;
-webkit
-box-orient
:
horizontal
;
/* Ancient
WebKit */
display
:
-
webkit-bo
x
;
-webkit-box-align
:
center
;
-webkit-box-orient
:
horizontal
;
/* Old
WebKit */
display
:
-
webkit-fle
x
;
-webkit-align-items
:
center
;
-webkit-flex-direction
:
row
;
/* Old WebKit
*/
display
:
-
webkit-
flex
;
-webkit-
align-items
:
center
;
-webkit-
flex-direction
:
row
;
/* W3C
*/
display
:
flex
;
align-items
:
center
;
flex-direction
:
row
;
/* W3C */
display
:
flex
;
align-items
:
center
;
flex-direction
:
row
;
padding-right
:
10px
;
}
#player
.controls
>
*
{
margin
:
0
.25em
;
margin
:
0
.25em
;
}
#player
.controls
#position-slider
{
-ms-flex
:
1
1
auto
;
-moz-box-flex
:
1
;
-webkit-box-flex
:
1
;
-webkit-flex
:
1
1
auto
;
flex
:
1
1
auto
;
-ms-flex
:
1
1
auto
;
-moz-box-flex
:
1
;
-webkit-box-flex
:
1
;
-webkit-flex
:
1
1
auto
;
flex
:
1
1
auto
;
}
#player
.controls
#play-pause
{
margin-left
:
0
;
//min-width: 5em;
margin-left
:
0
;
//min-width: 5em;
}
#player
.controls
#position
,
#player
.controls
#duration
{
font-family
:
monospace
;
font-family
:
monospace
;
}
#player
.controls
#duration
{
margin-right
:
0
;
margin-right
:
0
;
}
src/app/pages/replay/guacamole/guacamole.component.ts
View file @
c026b578
...
...
@@ -55,6 +55,7 @@ export class ReplayGuacamoleComponent implements OnInit {
recording
:
any
;
playerRef
:
any
;
displayRef
:
any
;
screenRef
:
any
;
max
=
100
;
percent
=
0
;
duration
=
'00:00'
;
...
...
@@ -70,21 +71,28 @@ export class ReplayGuacamoleComponent implements OnInit {
}
this
.
playerRef
=
document
.
getElementById
(
'player'
);
this
.
displayRef
=
document
.
getElementById
(
'display'
);
this
.
screenRef
=
document
.
getElementById
(
'screen'
);
const
tunnel
=
new
Guacamole
.
StaticHTTPTunnel
(
this
.
replay
.
src
);
this
.
recording
=
new
Guacamole
.
SessionRecording
(
tunnel
);
const
recordingDisplay
=
this
.
recording
.
getDisplay
();
this
.
displayRef
.
appendChild
(
recordingDisplay
.
getElement
());
const
recordingElement
=
recordingDisplay
.
getElement
();
recordingElement
.
style
.
margin
=
'0 auto'
;
this
.
screenRef
.
appendChild
(
recordingElement
);
this
.
initRecording
();
const
that
=
this
;
recordingDisplay
.
onresize
=
function
displayResized
(
width
,
height
)
{
recordingDisplay
.
onresize
=
function
onDisplayResize
(
width
,
height
)
{
// Do not scale if displayRef has no width
if
(
!
width
)
{
if
(
!
height
)
{
return
;
}
// Scale displayRef to fit width of container
recordingDisplay
.
scale
(
that
.
displayRef
.
offsetWidth
/
width
);
const
widthScale
=
that
.
displayRef
.
offsetWidth
/
width
;
const
heightScale
=
that
.
displayRef
.
offsetHeight
/
height
;
console
.
log
(
'old => new: '
,
widthScale
,
heightScale
);
const
minScale
=
widthScale
<
heightScale
?
widthScale
:
heightScale
;
recordingDisplay
.
scale
(
minScale
);
// recordingDisplay.scale(that.displayRef.offsetHeigth / height);
};
// this.toggle();
}
...
...
src/app/pages/replay/replay.component.ts
View file @
c026b578
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
ActivatedRoute
,
Params
}
from
'@angular/router'
;
import
{
ActivatedRoute
}
from
'@angular/router'
;
import
{
HttpService
,
LogService
}
from
'@app/app.service'
;
import
{
DataStore
}
from
'@app/globals'
;
import
{
Replay
}
from
'./replay.model'
;
@
Component
({
...
...
@@ -15,25 +14,22 @@ export class PagesReplayComponent implements OnInit {
constructor
(
private
route
:
ActivatedRoute
,
private
_http
:
HttpService
,
private
_logger
:
LogService
)
{
DataStore
.
NavShow
=
false
;
}
ngOnInit
()
{
let
token
=
''
;
this
.
route
.
params
.
subscribe
(
params
=>
{
token
=
params
[
'token'
];
});
this
.
_http
.
getReplay
(
token
)
.
subscribe
(
data
=>
{
this
.
replay
.
type
=
data
[
'type'
];
this
.
replay
.
src
=
data
[
'src'
];
this
.
replay
.
id
=
data
[
'id'
];
},
err
=>
{
alert
(
'没找到录像文件'
);
}
);
let
sid
=
''
;
this
.
route
.
params
.
subscribe
(
params
=>
{
sid
=
params
[
'sid'
];
});
this
.
_http
.
getReplay
(
sid
).
subscribe
(
data
=>
{
this
.
replay
.
type
=
data
[
'type'
];
this
.
replay
.
src
=
data
[
'src'
];
this
.
replay
.
id
=
data
[
'id'
];
},
err
=>
{
alert
(
'没找到录像文件'
);
}
);
}
}
src/app/router/router.module.ts
View file @
c026b578
...
...
@@ -10,7 +10,7 @@ import {ElementSftpComponent} from '../elements/sftp/sftp.component';
const
appRoutes
:
Routes
=
[
{
path
:
'replay/:
token
'
,
component
:
PagesReplayComponent
},
{
path
:
'replay/:
sid
'
,
component
:
PagesReplayComponent
},
{
path
:
'monitor/:token'
,
component
:
PagesMonitorComponent
},
{
path
:
'connect'
,
component
:
PagesConnectComponent
},
{
path
:
'sftp'
,
component
:
ElementSftpComponent
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment