{"id":21561445,"url":"https://github.com/lewinjun/react-native-aliyunplayer","last_synced_at":"2025-10-13T16:16:55.075Z","repository":{"id":38410545,"uuid":"392253739","full_name":"LewinJun/react-native-aliyunplayer","owner":"LewinJun","description":"阿里云播放器 react native","archived":false,"fork":false,"pushed_at":"2021-09-01T12:12:30.000Z","size":448,"stargazers_count":9,"open_issues_count":2,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-18T13:12:38.673Z","etag":null,"topics":["aliplayer","react-native-video","reactnative","video"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LewinJun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-03T08:59:11.000Z","updated_at":"2024-10-23T06:31:18.000Z","dependencies_parsed_at":"2022-09-03T07:11:37.361Z","dependency_job_id":null,"html_url":"https://github.com/LewinJun/react-native-aliyunplayer","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LewinJun%2Freact-native-aliyunplayer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LewinJun%2Freact-native-aliyunplayer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LewinJun%2Freact-native-aliyunplayer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LewinJun%2Freact-native-aliyunplayer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LewinJun","download_url":"https://codeload.github.com/LewinJun/react-native-aliyunplayer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248215193,"owners_count":21066622,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aliplayer","react-native-video","reactnative","video"],"created_at":"2024-11-24T09:22:37.986Z","updated_at":"2025-10-13T16:16:50.012Z","avatar_url":"https://github.com/LewinJun.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-native-lewin-aliyunplayer\n阿里云播放器 react native,播放暂停等1.0版本没有UI，需自定义\n\n\n## Table of contents\n- [Install](#install)\n- [Usage](#usage)\n\n\n## Install\n### 1: yarn add 或者npm install\n`yarn add react-native-lewin-aliyunplayer `\n\n### 2: android需要配置build.gradle maven {url 'https://maven.aliyun.com/repository/releases'}\n```xml\nallprojects {\n    repositories {\n        mavenLocal()\n        maven {\n            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm\n            url(\"$rootDir/../node_modules/react-native/android\")\n        }\n        maven {\n            // Android JSC is installed from npm\n            url(\"$rootDir/../node_modules/jsc-android/dist\")\n        }\n        maven {\n            url 'https://maven.aliyun.com/repository/releases'\n        }\n        google()\n        jcenter()\n        maven { url 'https://www.jitpack.io' }\n    }\n}\n```\n\n## Usage\n```javascript\nthis.player?.startPlay() : this.player?.pausePlay()\n\u003cAliPlayer\n    ref={(e) =\u003e this.player = e}\n    style={{ flex: 1 }}\n    source='https://d-appimg.doctopia.com.cn/video/1626170384423967.mp4'\n    setAutoPlay={true}\n    setLoop={true}\n    onAliCurrentPositionUpdate={(e) =\u003e {\n        // console.log(e.nativeEvent)\n    }}\n    onAliPrepared={(e) =\u003e {\n        console.log(e.nativeEvent)\n    }}\n/\u003e\n```\n\n\u003e 属性和方法回调，可以看index.tsx\n\n```javascript\n\ninterface AliPlayerProps {\n    style?: StyleProp\u003cViewStyle\u003e;\n    source?: string; // 播放地址\n    setAutoPlay?: boolean; // 是否自动播放\n    setLoop?: boolean; // 是否循环播放\n    setMute?: boolean; //是否静音\n    enableHardwareDecoder?: boolean; //是否开启硬件解码\n    setVolume?: number; //设置播放器音量,范围0~1.\n    setSpeed?: number; //播放速率，0.5-2.0之间，1为正常播放\n    setReferer?: string; //设置请求referer\n    setUserAgent?: string; // 设置UserAgent\n    setMirrorMode?: number; // 0:无镜像;1:横向;2:竖向\n    setRotateMode?: number; // 设置旋转 0:0度;1:90度;2:180度;3:270度;\n    setScaleMode?: number; // 设置画面缩放模式 0:宽高比适应;1:宽高比填充;2:拉伸填充;\n    configHeader?: Array\u003cany\u003e; // 配置自定义header\n    selectBitrateIndex?: number; // 切换清晰度  选择清晰度的index，-1代表自适应码率\n\n    onAliCompletion?: (e: AliPlayerFuncParams\u003c{ code: \"onAliCompletion\" }\u003e) =\u003e void, // 播放完成事件\n    onAliError?: (e: AliPlayerFuncParams\u003c{ code: string; message: string }\u003e) =\u003e void, // 出错事件\n    onAliLoadingBegin?: (e: AliPlayerFuncParams\u003c{ code: \"onAliLoadingBegin\" }\u003e) =\u003e void, // 缓冲开始。\n    onAliLoadingProgress?: (e: AliPlayerFuncParams\u003c{ percent: number }\u003e) =\u003e void, // 缓冲进度\n    onAliLoadingEnd?: (e: AliPlayerFuncParams\u003c{ code: \"onAliLoadingEnd\" }\u003e) =\u003e void, // 缓冲结束\n    onAliPrepared?: (e: AliPlayerFuncParams\u003c{ duration: number }\u003e) =\u003e void, // 准备成功事件\n    onAliRenderingStart?: (e: AliPlayerFuncParams\u003c{ code: \"onRenderingStart\" }\u003e) =\u003e void, // 首帧渲染显示事件\n    onAliSeekComplete?: (e: AliPlayerFuncParams\u003c{ code: \"onAliSeekComplete\" }\u003e) =\u003e void, // 拖动结束\n    onAliCurrentPositionUpdate?: (e: AliPlayerFuncParams\u003c{ position: number }\u003e) =\u003e void, // 播放进度\n    onAliBufferedPositionUpdate?: (e: AliPlayerFuncParams\u003c{ position: number }\u003e) =\u003e void, // 缓冲进度\n    onAliAutoPlayStart?: (e: AliPlayerFuncParams\u003c{ code: \"onAliAutoPlayStart\" }\u003e) =\u003e void, // 自动播放开始\n    onAliLoopingStart?: (e: AliPlayerFuncParams\u003c{ code: \"onAliLoopingStart\" }\u003e) =\u003e void, // 循环播放开始\n    onAliBitrateChange?: (e: AliPlayerFuncParams\u003c{ index: number; width: number; height: number }\u003e) =\u003e void, // 切换清晰度\n    onAliBitrateReady?: (e: AliPlayerFuncParams\u003c{ index: number; width: number; height: number; bitrate: number }\u003e) =\u003e void, // 获取清晰度回调\n}\n\ninterface AliPlayerFuncParams\u003cT\u003e {\n    nativeEvent: T\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flewinjun%2Freact-native-aliyunplayer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flewinjun%2Freact-native-aliyunplayer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flewinjun%2Freact-native-aliyunplayer/lists"}