Skip to content

Commit 8aeea6d

Browse files
committed
[ ADD ] currentSize prop
1 parent ca21244 commit 8aeea6d

File tree

6 files changed

+255
-22
lines changed

6 files changed

+255
-22
lines changed

android/src/main/java/com/ghondar/vlc/VlcPlayerModule.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ public Map getExportedCustomDirectEventTypeConstants() {
4949
@ReactProp(name = PROP_SOURCE)
5050
public void setPath(final VlcPlayerView playerView, ReadableMap map) {
5151
String path = map.getString("uri");
52+
int currentSize = map.getInt("currentSize");
5253
boolean autoPlay = map.getBoolean("autoplay");
53-
Log.d("data:", path);
54+
playerView.setCurrentSize(currentSize);
5455
playerView.setAutoPlay(autoPlay);
5556
playerView.setFilePath(path);
5657
}

android/src/main/java/com/ghondar/vlc/VlcPlayerView.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@ public void setAutoPlay(boolean autoPlay) {
297297
this.autoPlay = autoPlay;
298298
}
299299

300+
public void setCurrentSize(int currentSize) {
301+
mCurrentSize = currentSize;
302+
}
303+
300304
/**
301305
* Play or pause the media.
302306
*/

example/App.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,35 @@
99
*/
1010

1111
import React, {Component} from 'react';
12-
import {
13-
StyleSheet,
14-
View
15-
} from 'react-native';
12+
import {StyleSheet, View} from 'react-native';
1613

17-
import VlcPlayer from 'react-native-vlc-player';
14+
import VlcPlayer, {SURFACE_16_9} from 'react-native-vlc-player';
1815

1916
export default class App extends Component {
2017
vlcplayer = React.createRef();
2118

2219
componentDidMount() {
23-
console.log(this.vlcplayer)
20+
console.log(this.vlcplayer);
2421
}
2522

2623
render() {
2724
return (
28-
<View
29-
style={[
30-
styles.container
31-
]}>
25+
<View style={[styles.container]}>
3226
<VlcPlayer
3327
ref={this.vlcplayer}
3428
style={{
3529
width: 300,
3630
height: 200,
3731
}}
32+
currentSize={SURFACE_16_9}
3833
paused={false}
3934
autoplay={true}
4035
source={{
4136
uri: 'file:///storage/emulated/0/Download/example.mp4',
4237
autoplay: true,
4338
initOptions: ['--codec=avcodec'],
44-
}} />
39+
}}
40+
/>
4541
</View>
4642
);
4743
}

0 commit comments

Comments
 (0)