Uploading video via media.upload() not working.

オープン
#267 コメント 3 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
52/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
grpc, typescript
領域
api

調査の方向性

Start with the media.upload() documentation and its supported media types, then reproduce the reported failures with the sample webm and mp4 uploads using the shown TypeScript call. Done means the supported video behavior is verified and either video uploads work as documented or the documentation accurately states their limitations.

索引モデルが issue の本文から書いたものです。

説明

I read in the docs that media.upload() supports uploading video types with not much documentation on filetypes, limits or any meaningful information on that.

So I tried adding video uploads to my App:

  const uploadPromises = matches.map(async (match) => {
    const dataUrl = match[1];
    const mediaCategory = match[2];
    const extension = match[3]?.toLowerCase();
    let mediaType: 'gif' | 'image' | 'video' = 'image';
    if (mediaCategory === 'video') {Z
      mediaType = 'video';
    } else if (extension === 'gif') {
      mediaType = 'gif';
    }
    console.log('Uploading media:', { mediaType });
    const response = await media.upload({ url: String(dataUrl), type: mediaType });
    return { dataUrl: String(dataUrl), mediaUrl: response.mediaUrl };
  });
  const uploadResults = await Promise.all(uploadPromises);
  for (const res of uploadResults) {
    finalContent = finalContent.replace(res.dataUrl, res.mediaUrl);
  } 

However I tried uploading a sample webm file and it returns:
Failed to upload media: Error: 2 UNKNOWN: stream error: stream ID 10557; PROTOCOL_ERROR; received from peer

I also tried an mp4 file:
Failed to upload media: Error: 2 UNKNOWN: grpc invocation failed with status 2; unable to poll media URL https://i/. redd. it/xxxxx.mp4 failed to poll media after 5 polling timestamps

I tried different file sizes. Even at 900KB it fails. Not sure why this happens. Can anybody confirm if I am doing something wrong?
I am not sure if I am doing something wrong or not. Not even sure if video uploads is even supported and that docs might need updating.
If I am not doing it wrong then you either need to update docs removing video as supported mediaType to avoid confusion or add the support.

主要言語
TypeScript
スター
210
フォーク
88
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

reddit/devvit のほかの issue

reddit/devvit の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。