DemoGeneratePlayURL.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. // Code generated by protoc-gen-volcengine-sdk
  2. // source: generatePlayURL
  3. // DO NOT EDIT!
  4. <?php
  5. require('../../vendor/autoload.php');
  6. $client = Volc\Service\Live\Live::getInstance();
  7. $client->setAccessKey('your ak');
  8. $client->setSecretKey('your sk');
  9. $request = new Volc\Service\Live\Models\Request\GeneratePlayURLRequest();
  10. $request->setVhost("your Vhost");
  11. $request->setDomain("your Domain");
  12. $request->setApp("your App");
  13. $request->setStream("your Stream");
  14. $request->setSuffix("your Suffix");
  15. $request->setType("your Type");
  16. $request->setValidDuration(0);
  17. $request->setExpiredTime("your ExpiredTime");
  18. $response = new Volc\Service\Live\Models\Response\GeneratePlayURLResponse();
  19. try {
  20. $response = $client->generatePlayURL($request);
  21. } catch (Exception $e) {
  22. echo $e, "\n";
  23. } catch (Throwable $e) {
  24. echo $e, "\n";
  25. }
  26. if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
  27. echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
  28. } else {
  29. echo $response->serializeToJsonString(), "\n";
  30. }