'Create a Daily room' returns Bad Request when I set 'variant' key in streaming_endpoints properties

Options

I have tested live stream features to store HLS outputs in my own aws S3 bucket.

It worked fine by default without variant key in streaming_endpoints properties.

But if I add 'variant' key in streaming_endpoints properties referring to this page below,

https://docs.daily.co/reference/rest-api/rooms/config#streaming_endpoints

I have received bad request executing 'create a Daily room.'

I have developed a system using daily-js.

Any suggestions to prevent this error?

Tagged:

Best Answer

  • rajneesh
    rajneesh Dailynista
    Answer ✓
    Options

    the property name is `variants` JSON is calling it `variant`

Answers

  • rajneesh
    rajneesh Dailynista
    Options

    Can you provide the exact curl (or request body) request which is giving you error.

  • Ryoko
    Ryoko Member
    Options


    Hello, this is a request which gave me a error.
    I call API from firebase cloud functions (node.js).

    const response = await fetch("https://api.daily.co/v1/rooms", {
    method: 'POST',
    headers,
    body: JSON.stringify({
    properties: {
    enable_recording: 'cloud',
    geo: 'ap-northeast-2',
    streaming_endpoints: [
    {
    name: "hls_s3",
    type: "hls",
    hls_config: {
    save_hls_recording: true,
    storage: {
    bucket_name: "my bucket name",
    bucket_region: "aws region",
    assume_role_arn: "arn:aws:iam::555555555555:role/DailyS3AccessRole",
    path: "recordings"
    },
    variant: [
    {
    width: 1920,
    height: 1080,
    fps: 30,
    bitrate: 3500,
    iframe_only: false
    },
    {
    width: 1280,
    height: 720,
    fps: 30,
    bitrate: 2500,
    iframe_only: false
    },
    {
    width: 640,
    height: 360,
    fps: 30,
    bitrate: 780,
    iframe_only: true
    }
    ],
    },
    }
    ],
    },
    }),
    });

    headers include

    const headers = {
      'Content-Type': 'application/json',
      Authorization: `Bearer ${process.env.DAILY_API_KEY}`,
    };
    

    Without variant key settings, this code worked fine.

    Any suggestions ?

  • Ryoko
    Ryoko Member
    Options

    @rajneesh
    Thank you for your comment. I added 's' to 'variant' and it worked fine.

    I hope Daily streaming_endpoints example documentation is corrected soon to avoid the mistake like me.

  • rajneesh
    rajneesh Dailynista
    edited April 12
    Options

    glad it was helpful !!

    I was checking the documentation and associated example here and the it says `variants`

    Please let me know where are you seeing the wrong example.