FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
API-Examples/macOS/APIExample/Common/VideoView.swift at main · kwa-android/API-Examples · GitHub
kwa-android
/
API-Examples
Public
forked from
AgoraIO/API-Examples
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
API-Examples
/
macOS
/
APIExample
/
Common
/
VideoView.swift
Copy path
More file actions
More file actions
Latest commit
History
History
History
92 lines (76 loc) · 2.29 KB
Breadcrumbs
API-Examples
/
macOS
/
APIExample
/
Common
/
VideoView.swift
Copy path
File metadata and controls
92 lines (76 loc) · 2.29 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
//
// VideoView.swift
// OpenVideoCall
//
// Created by GongYuhua on 2/14/16.
// Copyright © 2016 Agora. All rights reserved.
//
import
Cocoa
protocol
NibLoadable
{
static
var
nibName
:
String
?
{
get
}
static
func
createFromNib
(
in bundle
:
Bundle
)
->
Self
?
}
extension
NibLoadable
where
Self
:
NSView
{
static
var
nibName
:
String
?
{
return
String
(
describing
:
Self
.
self
)
}
static
func
createFromNib
(
in bundle
:
Bundle
=
Bundle
.
main
)
->
Self
?
{
guard
let
nibName
=
nibName
else
{
return
nil
}
var
topLevelArray
:
NSArray
?
=
nil
bundle
.
loadNibNamed
(
NSNib
.
Name
(
nibName
)
,
owner
:
self
,
topLevelObjects
:
&
topLevelArray
)
guard
let
results
=
topLevelArray
else
{
return
nil
}
let
views
=
Array
<
Any
>
(
results
)
.
filter
{
$0 is
Self
}
return
views
.
last
as?
Self
}
}
class
VideoView
:
NSView
,
NibLoadable
{
@
IBOutlet
weak
var
placeholder
:
NSTextField
!
@
IBOutlet
weak
var
videocanvas
:
NSView
!
@
IBOutlet
weak
var
infolabel
:
NSTextField
!
@
IBOutlet
weak
var
statsLabel
:
NSTextField
!
var
uid
:
UInt
?
{
didSet
{
infolabel
.
stringValue
=
uid
==
nil
?
"
"
:
"
\(
uid!
)
"
}
}
var
audioOnly
:
Bool
=
false
enum
StreamType
{
case
local
case
remote
func
isLocal
(
)
->
Bool
{
switch
self
{
case
.
local
:
return
true
case
.
remote
:
return
false
}
}
}
var
statsInfo
:
StatisticsInfo
?
{
didSet
{
guard
let
stats
=
statsInfo
else
{
return
}
statsLabel
.
stringValue
=
stats
.
description
(
audioOnly
:
audioOnly
)
}
}
var
type
:
StreamType
?
override
func
awakeFromNib
(
)
{
super
.
awakeFromNib
(
)
}
}
class
MetalVideoView
:
NSView
,
NibLoadable
{
@
IBOutlet
weak
var
placeholder
:
NSTextField
!
@
IBOutlet
weak
var
videocanvas
:
AgoraMetalRender
!
@
IBOutlet
weak
var
infolabel
:
NSTextField
!
var
uid
:
UInt
?
{
didSet
{
infolabel
.
stringValue
=
uid
==
nil
?
"
"
:
"
\(
uid!
)
"
}
}
override
func
awakeFromNib
(
)
{
super
.
awakeFromNib
(
)
}
}
class
SampleBufferDisplayView
:
NSView
,
NibLoadable
{
@
IBOutlet
weak
var
videoView
:
AgoraSampleBufferRender
!
override
func
awakeFromNib
(
)
{
super
.
awakeFromNib
(
)
}
}
Back
|
FazBrowse Home
|
New Git URL