React Native Video Expo AV 服务器配置不正确。 AVPlayerItem 实例失败,错误代码为 -11850

问题描述 投票:0回答:1

我在我的 IOS 设备上使用 React Native expo-av 时遇到问题。由于某种原因,我想要的视频没有播放。但是,当我使用博览会文档中给出的视频(https://d23dyxeqlo5psv.cloudfront.net/big_buck_bunny.mp4)时,它正在工作。

我想播放但遇到问题的视频:https://player.vimeo.com/video/949579770?h=897cd5e78

错误日志:

YYYYYYYY {"error": "The server is not correctly configured. - The AVPlayerItem instance has failed with the error code -11850 and domain \"AVFoundationErrorDomain\".", "isLoaded": false}

这是示例片段:

     import { Video, ResizeMode } from "expo-av";
     <Video
          source={{
            uri: "https://player.vimeo.com/video/949579770?h=897cd5e781.mp4" (with or without .mp4, still not working),
          }}
          className="w-52 h-72 rounded-[35px] mt-3 bg-white/30"
          resizeMode={ResizeMode.CONTAIN}
          useNativeControls
          shouldPlay
          onPlaybackStatusUpdate={(status) => console.log("YYYYYYYY", status)}
          onLoad={(status) => console.log("XXXXXXXXXXXXXXX", status)}
        />

非常需要帮助,这与我想播放的视频本身有关吗? 我正在关注有关 JS 掌握 React Native 的 YouTube 课程。因为在教程方面,他的工作正在发挥作用

非常感谢你

设备:Windows 11 节点版本:v20.14.0 打字稿?:是的 包.json:

{
  "name": "aora",
  "main": "expo-router/entry",
  "version": "1.0.0",
  "scripts": {
    "start": "expo start",
    "reset-project": "node ./scripts/reset-project.js",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "test": "jest --watchAll",
    "lint": "expo lint"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "@expo/vector-icons": "^14.0.2",
    "@react-navigation/native": "^6.0.2",
    "expo": "~51.0.24",
    "expo-av": "^14.0.6",
    "expo-constants": "~16.0.2",
    "expo-font": "~12.0.9",
    "expo-linking": "~6.3.1",
    "expo-router": "~3.5.20",
    "expo-splash-screen": "~0.27.5",
    "expo-status-bar": "~1.12.1",
    "expo-system-ui": "~3.0.7",
    "expo-web-browser": "~13.0.3",
    "nativewind": "^2.0.11",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.74.3",
    "react-native-animatable": "^1.4.0",
    "react-native-appwrite": "^0.4.0",
    "react-native-gesture-handler": "~2.16.1",
    "react-native-reanimated": "~3.10.1",
    "react-native-safe-area-context": "4.10.5",
    "react-native-screens": "3.31.1",
    "react-native-url-polyfill": "^2.0.0",
    "react-native-web": "~0.19.10"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@types/jest": "^29.5.12",
    "@types/react": "~18.2.45",
    "@types/react-test-renderer": "^18.0.7",
    "jest": "^29.2.1",
    "jest-expo": "~51.0.3",
    "react-test-renderer": "18.2.0",
    "tailwindcss": "^3.3.2",
    "typescript": "~5.3.3"
  },
  "private": true
}

播放我想要的视频时的实际图像:enter image description here

我会重复一遍,但是当使用 bunny.mp4 时,它正在工作和播放

react-native expo expo-av
1个回答
0
投票

我在学习课程时遇到了同样的错误。经过研究,我发现出现错误是因为 AVFoundation 无法识别 Vimeo 链接的媒体格式。

我找到了一个有效的解决方案:不使用 JSMastery 提供的 Vimeo 链接,而是使用直接视频 URL。这些链接直接指向视频文件本身,而不是显示视频的网页。

希望这些信息可以帮助您解决问题!

© www.soinside.com 2019 - 2024. All rights reserved.