Skip to content

Commit

Permalink
Made aspect property for Android accessible
Browse files Browse the repository at this point in the history
  • Loading branch information
bnussey committed Dec 15, 2016
1 parent 925d037 commit afe82d3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ A NativeScript plugin to provide the ability to play local and remote videos.
#### Platform controls used:
Android | iOS
---------- | -----------
[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)
[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)


## Sample Usage
Expand Down Expand Up @@ -81,6 +81,10 @@ Mutes the native video player.

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

- **aspect - (boolean)** - *optional* **ANDROID ONLY**

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.Ï

- **loadingComplete - (function)** - *optional* **ANDROID ONLY**

Attribute to specify an event callback to execute when the video has loaded.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nativescript-videoplayer",
"version": "1.1.6",
"version": "2.0.0",
"main": "videoplayer.js",
"typings": "videoplayer.d.ts",
"description": "A NativeScript plugin that uses the native video players to play local and remote videos.",
Expand Down
14 changes: 14 additions & 0 deletions videoplayer-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var AUTOPLAY = "autoplay";
var CONTROLS = "controls";
var LOOP = "loop";
var MUTED = "muted";
var ASPECT = "aspect";

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

constructor() {
super();
Expand Down Expand Up @@ -147,6 +153,14 @@ export class Video extends view.View {
this._setValue(Video.mutedProperty, value);
}

get aspect(): any {
return this._getValue(Video.aspectProperty);
}
set aspect(value: any) {
this._setValue(Video.aspectProperty, value);
}


public _setNativeVideo(nativeVideo: any) {
//
}
Expand Down

0 comments on commit afe82d3

Please sign in to comment.