3Speak - Ecency integration - upload_info api with open source sample code

in #hive-1813352 years ago

▶️ Watch on 3Speak


Hello Team Ecency,

With this Video, I'll explain followings

  • video upload with TUS
  • thumbnail upload with TUS
  • consume upload_info API

Where to find source code?

EndPoints

const studioEndPoint = "https://studio.3speak.tv";
const tusEndPoint = "https://uploads.3speak.tv/files/";

Code snippet for upload_info

 async function updateVideoInfo(
    oFilename,
    videoUrl,
    thumbnailUrl,
  ) {
    try {
      const { data } = await axios.post(
        `${studioEndPoint}/mobile/api/upload_info`,
        {
          filename: videoUrl,
          oFilename: oFilename,
          size: 9609313, // NOTE: please change (in bytes)
          duration: 40, // NOTE: please change (seconds)
          thumbnail: thumbnailUrl, 
          owner: username,
          isReel: false, // if video is a reel/3shorts
        },
        {
          withCredentials: false,
          headers: {
            "Content-Type": "application/json",
            "Authorization": `Bearer ${accessToken}`,
          },
        }
      );
      return data;
    } catch (e) {
      console.error(e);
      throw e;
    }
  }

Code snippet for getting status of all videos of a user

  async function getAllVideoStatuses(access_token) {
    try {
      let response = await client.get(
        `${studioEndPoint}/mobile/api/my-videos`,
        {
          withCredentials: false,
          headers: {
            "Content-Type": "application/json",
            Authorization: `Bearer ${access_token}`,
          },
        }
      );
      return response.data;
    } catch (err) {
      console.log(err);
      throw err;
    }
  }

Why here?

  • We are building open source code base.
  • I think, with this video, I can help more users who wants to integrate APIs
  • More clients can integrate with Spknetwork

More Queries

  • Please reach out to me in discord 3Speak server
  • Or Add comment below the post

Support Me

Please 🙏Support Me
Donate Hive Or HBD Vote me as Hive Witness

Other Communities

I recommend joining these communities on Hive & Discord.


Click on the banner to join

Click on the banner to join


Important 3Speak Links

3Speak.tv3Speak Twitter3Speak Hive3Speak Telegram
3Speak in SpanishDownload Android AppDownload iOS AppDownload Desktop App
Join 3Speak DiscordSetup Encoder NodeVote for 3Speak ProposalVote 3Speak as Witness

Cheers
Have a good one


▶️ 3Speak

Sort:  

Can we use Ecency editor to upload videos directly to 3Speak server after this integration takes place?

Hey @lordshah
Team Ecency is working on it.
They will provide update whenever it's done.

Nice to know. Thanks

https://leofinance.io/threads/@lordshah/re-leothreads-2tkhjuveu
The rewards earned on this comment will go directly to the people ( lordshah ) sharing the post on LeoThreads,LikeTu,dBuzz.

Thank you for this! 👍


The rewards earned on this comment will go directly to the people( @sagarkothari88 ) sharing the post on Twitter as long as they are registered with @poshtoken. Sign up at https://hiveposh.com.

Congratulations @sagarkothari88! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)

You distributed more than 27000 upvotes.
Your next target is to reach 28000 upvotes.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Check out our last posts:

Hive Power Up Day - April 1st 2023
Happy Birthday to the Hive Community
The Hive Gamification Proposal