Skip to content

Commit

Permalink
Merge branch 'master' into chore/fix_lintter_warning
Browse files Browse the repository at this point in the history
  • Loading branch information
freeboub authored Oct 16, 2022
2 parents 9f9a411 + 36d7afa commit f25308b
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 15 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

### Version 6.0.0-alpha.4

- ensure src is always provided to native player even if it is invalid [#2857](https://github.com/react-native-video/react-native-video/pull/2857)
- Sample: Add react-native-video controls support [#2852](https://github.com/react-native-video/react-native-video/pull/2852)
- Android: Switch Google's maven repository to default `google()` [#2860](https://github.com/react-native-video/react-native-video/pull/2860)
- Android: Implement focusable prop so the video view can toggle whether it is focusable for non-touch devices [#2819](https://github.com/react-native-video/react-native-video/issues/2819)
- Fix iOS RCTSwiftLog naming collision [#2868](https://github.com/react-native-video/react-native-video/issues/2868)
- Android: fix linter warning [#2891] (https://github.com/react-native-video/react-native-video/pull/2891)
- Fix iOS RCTSwiftLog naming collision [#2868](https://github.com/react-native-video/react-native-video/issues/2868)
- Added "homepage" to package.json [#2882](https://github.com/react-native-video/react-native-video/pull/2882)

### Version 6.0.0-alpha3
### Version 6.0.0-alpha.3

- Fix ios build [#2854](https://github.com/react-native-video/react-native-video/pull/2854)

Expand Down
14 changes: 9 additions & 5 deletions Video.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,16 +276,20 @@ export default class Video extends Component {
let uri = source.uri || '';
if (uri && uri.match(/^\//)) {
uri = `file://${uri}`;
} else if (uri === '') {
return null;
}

if (!uri) {
console.warn('Trying to load empty source.');
console.log('Trying to load empty source.');
}

const isNetwork = !!(uri && uri.match(/^https?:/));
const isAsset = !!(uri && uri.match(/^(assets-library|ph|ipod-library|file|content|ms-appx|ms-appdata):/));
const isNetwork = !!(uri && uri.match(/^https?:/i));
const isAsset = !!(uri && uri.match(/^(assets-library|ph|ipod-library|file|content|ms-appx|ms-appdata):/i));

if ((uri || uri === '') && !isNetwork && !isAsset) {
if (this.props.onError) {
this.props.onError({error: {errorString: 'invalid url, player will stop', errorCode: 'INVALID_URL'}});
}
}

let nativeResizeMode;
const RCTVideoInstance = this.getViewManagerConfig('RCTVideo');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ public void setSrc(final ReactExoplayerView videoView, @Nullable ReadableMap src
if (srcUri != null) {
videoView.setRawSrc(srcUri, extension);
}
} else {
videoView.clearSrc();
}
}
}
Expand Down Expand Up @@ -390,11 +392,12 @@ public void setBufferConfig(final ReactExoplayerView videoView, @Nullable Readab
}

private boolean startsWithValidScheme(String uriString) {
return uriString.startsWith("http://")
|| uriString.startsWith("https://")
|| uriString.startsWith("content://")
|| uriString.startsWith("file://")
|| uriString.startsWith("asset://");
String lowerCaseUri = uriString.toLowerCase();
return lowerCaseUri.startsWith("http://")
|| lowerCaseUri.startsWith("https://")
|| lowerCaseUri.startsWith("content://")
|| lowerCaseUri.startsWith("file://")
|| lowerCaseUri.startsWith("asset://");
}

private @ResizeMode.Mode int convertToIntDef(String resizeModeOrdinalString) {
Expand Down
10 changes: 8 additions & 2 deletions examples/basic/src/VideoPlayer.android.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ class VideoPlayer extends Component {
'http://www.youtube.com/api/manifest/dash/id/bf5bb2419360daf1/source/youtube?as=fmp4_audio_clear,fmp4_sd_hd_clear&sparams=ip,ipbits,expire,source,id,as&ip=0.0.0.0&ipbits=0&expire=19000000000&signature=51AF5F39AB0CEC3E5497CD9C900EBFEAECCCB5C7.8506521BFC350652163895D4C26DEE124209AA9E&key=ik0',
type: 'mpd',
},
{
description: 'invalid URL',
uri:
'mmt://www.youtube.com',
type: 'mpd',
},
{ description: '(no url) Stopped playback', uri: undefined },
{
description: '(no view) no View',
Expand Down Expand Up @@ -247,8 +253,8 @@ class VideoPlayer extends Component {
}

onError = (err: any) => {
console.log(JSON.stringify(err))
this.toast(true, 'error: ' + err?.error?.code)
console.log(JSON.stringify(err?.error.errorCode))
this.toast(true, 'error: ' + err?.error.errorCode)
}

onEnd = () => {
Expand Down
2 changes: 1 addition & 1 deletion ios/Video/RCTVideo-Bridging-Header.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#import <React/RCTViewManager.h>
#import "RCTSwiftLog.h"
#import "RCTVideoSwiftLog.h"

#if __has_include(<react-native-video/RCTVideoCache.h>)
#import "RCTVideoCache.h"
Expand Down
6 changes: 6 additions & 0 deletions ios/Video/RCTVideo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
@objc
func setSrc(_ source:NSDictionary!) {
_source = VideoSource(source)
if (_source?.uri == nil || _source?.uri == "") {
DispatchQueue.global(qos: .default).async {
self._player?.replaceCurrentItem(with: nil)
}
return;
}
removePlayerLayer()
_playerObserver.player = nil
_playerObserver.playerItem = nil
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "Video.js",
"license": "MIT",
"author": "Community Contributors",
"homepage": "https://github.com/react-native-video/react-native-video#readme",
"repository": {
"type": "git",
"url": "[email protected]:react-native-video/react-native-video.git"
Expand Down

0 comments on commit f25308b

Please sign in to comment.