How to get Live URL from vimeo api

35 views Asked by At

I have seen lot of solutions for my question but none seems working. For instance, from this link https://developer.vimeo.com/api/live/playback I tried getting the live url but its showing some permission error.

here is the curl command to test it.

curl -X GET \
  -H "Authorization: Basic MGYzOWQwN2Q1OWUyNGRiNzJjNWY3ZTE2MTUxMTQyYjZhMjZmN2VmNTptZmNjdnZnWHA5SnNqQjhTQTE0dkxPTTFzQjFoc2E1Y0hOU3dEdjRNMWNmTnVsWUp5cjdjZ1haL1lRK0ZRNWNsVERaa0R3bCtRb2JzNXpjZzZWVVhmL0dPK0oweE5sTW9CdWh2WG1hVnFReGhWK0hSZlFZZG5hbWxaOEtZLytjKw==" \
-H "Accept: application/vnd.vimeo.*+json;version=3.4" \
"https://api.vimeo.com/me/live_events/907930022/m3u8_playback"

here is my nodeJs code.

       import { Vimeo } from "vimeo";

       const client = new Vimeo(CLIENT_ID, CLIENT_SECRET, ACCESS_TOKEN);
       
       const headers = {
        'Accept': 'application/vnd.vimeo.*+json;version=3.4',
       };

      const liveEventParams = {
    type: 'live',
    name: 'Scheduled Live Event',
    start_time: scheduleTime, 
    description: 'Live event test',
    privacy: {
      view: 'anybody', 
    },
  };

      const clientData = ()=>{
          return new Promise((resolve, reject) =>{
          client.request({
            method: 'post',
            path: '/me/videos',
            headers:headers,
            query: liveEventParams,
          },(error, body, status_code, headers) => {
            if (error) {
              console.log('Error scheduling live event:', error);
              reject(new GraphQLError(error, {
                  extensions: { code: 'UNAUTHENTICATED' },
                  path: 'createMedia',
              }));

            } else {
              const liveEventId = body.uri.split('/').pop();
              resolve({ liveEventId, body, status_code });
            }
          })})}

        const { liveEventId,body,status_code } = await clientData();
        console.log("----body",body)

and this works fine, im getting the url of videos/eventid but Im not getting the live url. How to get the live url when scheduled and created ? Im only getting the videos category which is not live.

0

There are 0 answers