हम Google API PHP Client के साथ YouTube लाइव स्ट्रीमिंग API का उपयोग कर रहे हैं और मैं यह नहीं कर सकता कि इसे मूल (प्रीसेट) इंजेक्शन का उपयोग कैसे करें कस्टम एकYouTube लाइव स्ट्रीमिंग API का उपयोग करते समय या डुप्लिकेट कस्टम वाले से बचने के लिए बुनियादी इंजेक्शन का उपयोग करना
कस्टम वाले ठीक हैं, लेकिन किसी कारण से यदि आप उन्हें एक ही नाम कहते हैं तो यह लगातार आपके द्वारा बनाए गए प्रत्येक स्ट्रीम के लिए डुप्लीकेट बनाता है।
तो मेरा सवाल यह है कि, हम इसे बुनियादी इंजेक्शन का उपयोग करने के लिए कैसे प्राप्त करते हैं या हर बार एक नया निर्माण किए बिना कस्टम का चयन करने में सक्षम होते हैं?
उदाहरण यहां के लिए बुनियादी घूस है जब आप सेटअप एक धारा मैन्युअल रूप से अपने YouTube खाते के भीतर का चयन कर सकते हैं:
प्रासंगिक पीएचपी कोड:
// Create an object for the liveBroadcast resource's snippet. Specify values
// for the snippet's title, scheduled start time, and scheduled end time.
$broadcastSnippet = new Google_Service_YouTube_LiveBroadcastSnippet();
$broadcastSnippet->setTitle($this->title);
$broadcastSnippet->setDescription($this->desc);
$broadcastSnippet->setScheduledStartTime($this->start_time);
// Create an object for the liveBroadcast resource's status, and set the
// broadcast's status.
$status = new Google_Service_YouTube_LiveBroadcastStatus();
$status->setPrivacyStatus($this->privacy_status);
// Create the API request that inserts the liveBroadcast resource.
$broadcastInsert = new Google_Service_YouTube_LiveBroadcast();
$broadcastInsert->setSnippet($broadcastSnippet);
$broadcastInsert->setStatus($status);
$broadcastInsert->setKind('youtube#liveBroadcast');
// Execute the request and return an object that contains information
// about the new broadcast.
$broadcastsResponse = $this->youtube->liveBroadcasts->insert('snippet,status', $broadcastInsert, array());
// Create an object for the liveStream resource's snippet. Specify a value
// for the snippet's title.
$streamSnippet = new Google_Service_YouTube_LiveStreamSnippet();
$streamSnippet->setTitle($this->stream_title);
// Create an object for content distribution network details for the live
// stream and specify the stream's format and ingestion type.
$cdn = new Google_Service_YouTube_CdnSettings();
# TODO: Update the below `Format` method to use the new 'resolution' and 'frameRate' methods
$cdn->setFormat($this->format);
$cdn->setIngestionType('rtmp');
// Create the API request that inserts the liveStream resource.
$streamInsert = new Google_Service_YouTube_LiveStream();
$streamInsert->setSnippet($streamSnippet);
$streamInsert->setCdn($cdn);
$streamInsert->setKind('youtube#liveStream');
// Execute the request and return an object that contains information
// about the new stream.
$streamsResponse = $this->youtube->liveStreams->insert('snippet,cdn', $streamInsert, array());
// Bind the broadcast to the live stream.
$bindBroadcastResponse = $this->youtube->liveBroadcasts->bind(
$broadcastsResponse['id'], 'id,contentDetails',
array(
'streamId' => $streamsResponse['id'],
));
* मूलभूत * * का उदाहरण दिखाने के लिए अद्यतन प्रश्न। – Brett
@ ब्रेट ने मेरा जवाब अपडेट किया। – JAL
हाँ, मुझे बहिष्कृत 'cdn.format' से अवगत है, लेकिन दुर्भाग्य से 'Google API PHP क्लाइंट' ने अभी तक इसे करने के नए तरीके के लिए समर्थन नहीं जोड़ा है AFAIK; कम से कम वी 1 शाखा में। – Brett