-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreate.php
157 lines (110 loc) · 5.07 KB
/
create.php
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
<!doctype html>
<html>
<?php
$loggedin = 0;
$loginUrl ="";
$errortype="";
$advancedinfo = "hidden";
include "header.php";
include "login.php";
$token = ($_SESSION[fb_token]);
?>
</ul>
</div>
</div>
</div>
<?php
if (!empty($_POST[profileid])) {
$id=$_POST[profileid];
}
elseif (!empty($_POST[pageid])) {
$id=$_POST[pageid];
$token=$_POST[pagetoken];
}
elseif (!empty($_POST[groupid])) {
$id=$_POST[groupid];
}
else {
//No target id provided, redirecting to Home
header('Location: ./');
}
try {
$response = $fb->post('/' . $id . '/live_videos', array (title => $_POST[title], description => $_POST[description]), $token );
} catch(\Facebook\Exceptions\FacebookResponseException $e) {
$errortype="Graph API";
include "error.php";
exit;
} catch(\Facebook\Exceptions\FacebookSDKException $e) {
$errortype="SDK";
include "error.php";
exit;
}
$responsearray = $response->getGraphNode()->asArray();
$livevideo = $fb->get('/' . $responsearray[id] . '?fields=id,title,description,stream_url,secure_stream_url')->getGraphNode()->asArray();
?>
<script src="https://unpkg.com/[email protected]/dist/clipboard.min.js"></script>
<script>
var clipboard = new ClipboardJS('.ctc-button');
clipboard.on('success', function(e) {
console.log(e);
});
clipboard.on('error', function(e) {
console.log(e);
});
</script>
<div class='content'>
<h2 class="content-head is-center">Go Live</h2>
<div class="infobox"
<label class="pure-form">
You Facebook Live Event was created. Now you can copy your RTMP Link to your transmitter app/device (e.g. GoPro app). Your livestream should be published automatically once Facebook receives a video signal. You can check this by pressing the button check status.
</label></div>
<label class="copylabel" for="rtmplink">RTMP Link</label>
<div class="input-group">
<input class="copyinput" type="text" name="rtmplink" id="rtmplink" value="<?php echo $livevideo[stream_url] ?>" readonly="readonly">
<span class="input-group-button">
<button class="pure-button ctc-button" type="button" data-clipboard-target="#rtmplink">
<i class="fas fa-clipboard-list"></i> Copy to Clipboard
</button>
</span>
</div>
<label class="copylabel" for="rtmpslink">RTMPS Link</label>
<div class="input-group">
<input class="copyinput" type="text" name="rtmpslink" id="rtmpslink" value="<?php echo $livevideo[secure_stream_url] ?>" readonly="readonly">
<span class="input-group-button">
<button class="pure-button ctc-button" type="button" data-clipboard-target="#rtmpslink">
<i class="fas fa-clipboard-list"></i> Copy to Clipboard
</button>
</span>
</div>
<label class="copylabel" for="serverurl">Server URL</label>
<div class="input-group">
<input class="copyinput" type="text" name="serverurl" id="serverurl" value="Parser not yet implemented" readonly="readonly">
<span class="input-group-button">
<button class="pure-button ctc-button" type="button" data-clipboard-target="#serverurl">
<i class="fas fa-clipboard-list"></i> Copy to Clipboard
</button>
</span>
</div>
<label class="copylabel" for="streamkey">Stream Key</label>
<div class="input-group">
<input class="copyinput" type="text" name="streamkey" id="streamkey" value="Parser not yet implemented" readonly="readonly">
<span class="input-group-button">
<button class="pure-button ctc-button" type="button" data-clipboard-target="#streamkey">
<i class="fas fa-clipboard-list"></i> Copy to Clipboard
</button>
</span>
</div>
<form class="pure-form pure-form-stacked">
<label for="eventid">Live Video ID</label>
<input type="text" name="eventid" id="eventid" value="<?php echo $livevideo[id] ?>" readonly="readonly">
<label for="title">Title</label>
<input type="text" name="title" id="title" value="<?php echo $livevideo[title] ?>" readonly="readonly">
<label for="description">Description</label>
<input type="text" name="description" id="description" value="<?php echo $livevideo[description] ?>" readonly="readonly">
<label for="page" hidden>Target</label>
<input type="text" name="page" id="page" value="<?php echo $_POST[page] ?>" readonly="readonly" hidden>
<label for="pageid" hidden>Target ID</label>
<input type="text" name="pageid" id="pageid" value="<?php echo $_POST[pageid] ?>" readonly="readonly" hidden>
</form>
<a href="./check.php?eventid=<?php echo $livevideo[id] ?>"> <button type="submit" class="pure-button button-create" > <i class="fas fa-video"></i> Check Status</button></a>
</div>