Skip to content

Commit afe82d3

Browse files
committed
Made aspect property for Android accessible
1 parent 925d037 commit afe82d3

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ A NativeScript plugin to provide the ability to play local and remote videos.
77
#### Platform controls used:
88
Android | iOS
99
---------- | -----------
10-
[Android VideoView](http://developer.android.com/intl/zh-tw/reference/android/widget/VideoView.html) | [iOS AVPlayer](https://developer.apple.com/library/prerelease/ios/documentation/AVFoundation/Reference/AVPlayer_Class/index.html)
10+
[Android MediaPlayer](https://developer.android.com/reference/android/media/MediaPlayer.html) | [iOS AVPlayer](https://developer.apple.com/library/prerelease/ios/documentation/AVFoundation/Reference/AVPlayer_Class/index.html)
1111

1212

1313
## Sample Usage
@@ -81,6 +81,10 @@ Mutes the native video player.
8181

8282
Sets the native video player to loop once playback has finished.
8383

84+
- **aspect - (boolean)** - *optional* **ANDROID ONLY**
85+
86+
Defaults to true. If set to false, the aspect ratio of the video will not be honored and it will fill the entire container available.Ï
87+
8488
- **loadingComplete - (function)** - *optional* **ANDROID ONLY**
8589

8690
Attribute to specify an event callback to execute when the video has loaded.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-videoplayer",
3-
"version": "1.1.6",
3+
"version": "2.0.0",
44
"main": "videoplayer.js",
55
"typings": "videoplayer.d.ts",
66
"description": "A NativeScript plugin that uses the native video players to play local and remote videos.",

videoplayer-common.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ var AUTOPLAY = "autoplay";
1717
var CONTROLS = "controls";
1818
var LOOP = "loop";
1919
var MUTED = "muted";
20+
var ASPECT = "aspect";
2021

2122
// on Android we explicitly set propertySettings to None because android will invalidate its layout (skip unnecessary native call).
2223
var AffectsLayout = platform.device.os === platform.platformNames.android ? dependencyObservable.PropertyMetadataSettings.None : dependencyObservable.PropertyMetadataSettings.AffectsLayout;
@@ -96,6 +97,11 @@ export class Video extends view.View {
9697
VIDEO,
9798
new proxy.PropertyMetadata(false, dependencyObservable.PropertyMetadataSettings.None)
9899
);
100+
public static aspectProperty = new dependencyObservable.Property(
101+
ASPECT,
102+
VIDEO,
103+
new proxy.PropertyMetadata(false, dependencyObservable.PropertyMetadataSettings.None)
104+
);
99105

100106
constructor() {
101107
super();
@@ -147,6 +153,14 @@ export class Video extends view.View {
147153
this._setValue(Video.mutedProperty, value);
148154
}
149155

156+
get aspect(): any {
157+
return this._getValue(Video.aspectProperty);
158+
}
159+
set aspect(value: any) {
160+
this._setValue(Video.aspectProperty, value);
161+
}
162+
163+
150164
public _setNativeVideo(nativeVideo: any) {
151165
//
152166
}

0 commit comments

Comments
 (0)