Skip to content

Commit 32f646b

Browse files
committed
adds prettier
1 parent daf430d commit 32f646b

File tree

5 files changed

+68
-64
lines changed

5 files changed

+68
-64
lines changed

package.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@
1616
"category": "Interface"
1717
}
1818
},
19+
"scripts": {
20+
"precommit": "lint-staged"
21+
},
22+
"lint-staged": {
23+
"*.ts": [
24+
"prettier --write",
25+
"git add"
26+
]
27+
},
1928
"repository": {
2029
"type": "git",
2130
"url": "git+https://github.com/bradmartin/nativescript-videoplayer.git"
@@ -67,7 +76,6 @@
6776
"bugs": {
6877
"url": "https://github.com/bradmartin/nativescript-videoplayer/issues"
6978
},
70-
"scripts": {},
7179
"homepage": "https://github.com/bradmartin/nativescript-videoplayer",
7280
"readme": "# NativeScript Video Player :clapper:\nA NativeScript plugin to provide an XML widget for playing local and remote video files.\n\n#### [Android VideoView](http://developer.android.com/intl/zh-tw/reference/android/widget/VideoView.html)\n#### [iOS AVPlayer](https://developer.apple.com/library/prerelease/ios/documentation/AVFoundation/Reference/AVPlayer_Class/index.html)\n\n## Installation\n`npm install nativescript-videoplayer`\n\n## Usage\n\n###\n```XML\n<Page xmlns=\"http://schemas.nativescript.org/tns.xsd\"\n xmlns:VideoPlayer=\"videoplayer\">\n <StackLayout>\n <VideoPlayer:Video\n loaded=\"videoplayerLoaded\" \n finished=\"videoFinished\" \n autoplay=\"true\" \n height=\"300\" \n src=\"~/videos/small.mp4\" />\n\n <!-- Here is a remote file to test with https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4 -->\n \n </StackLayout>\n</Page>\n```\n\n## Attributes\n**src** - *required*\n\nAttribute to specify the video file to play, can either be a remote file or local video file. \n\n<sub>The file must adhere to the platforms accepted video formats. For reference check the platform specs on playing videos.</sub>\n\n**autoplay** - *optional*\n\nAttribute to set if the video should start playing as soon as possible or to wait for user interaction.\n\n**finished** - *optional*\n\nAttribute to specify an event callback to execute when the video reaches the end of its duration.\n\n",
7381
"readmeFilename": "README.md",
@@ -80,8 +88,11 @@
8088
"tns-core-modules": "^3.0.0"
8189
},
8290
"devDependencies": {
83-
"typescript": "^2.2.2",
91+
"husky": "^0.13.4",
92+
"lint-staged": "^3.6.1",
93+
"prettier": "^1.4.4",
8494
"tns-core-modules": "^3.0.0",
85-
"tns-platform-declarations": "3.0.1"
95+
"tns-platform-declarations": "3.0.1",
96+
"typescript": "^2.2.2"
8697
}
8798
}

videoplayer-common.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
import videoSource = require("./video-source/video-source");
1+
import videoSource = require("./video-source/video-source");
22
import * as definitions from "./videoplayer";
3-
import { isFileOrResourcePath } from "utils/utils";
4-
import { isString } from "utils/types";
5-
import { View, Property, booleanConverter } from "ui/core/view";
3+
import { isFileOrResourcePath } from "tns-core-modules/utils/utils";
4+
import { isString } from "tns-core-modules/utils/types";
5+
import {
6+
View,
7+
Property,
8+
booleanConverter
9+
} from "tns-core-modules/ui/core/view";
610

711
// on Android we explicitly set propertySettings to None because android will invalidate its layout (skip unnecessary native call).
812
// var AffectsLayout = platform.device.os === platform.platformNames.android ? dependencyObservable.PropertyMetadataSettings.None : dependencyObservable.PropertyMetadataSettings.AffectsLayout;

videoplayer.android.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import common = require("./videoplayer-common");
1+
import common = require("./videoplayer-common");
22
import videoSource = require("./video-source/video-source");
3-
import * as utils from "utils/utils";
4-
import * as timer from "timer";
3+
import * as utils from "tns-core-modules/utils/utils";
4+
import * as timer from "tns-core-modules/timer";
55

66
export * from "./videoplayer-common";
77

videoplayer.d.ts

Lines changed: 42 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,104 @@
1-
import { View } from 'ui/core/view';
1+
import { View } from "ui/core/view";
22
export declare class Video extends View {
3-
4-
android: any;
5-
ios: any;
6-
src: string; /// video source file
7-
loop: boolean; /// whether the video loops the playback after extends
8-
autoplay: boolean; /// set true for the video to start playing when ready
9-
controls: boolean; /// set true to enable the media player's playback controls
10-
_emit: any;
11-
12-
/**
3+
android: any;
4+
ios: any;
5+
src: string; /// video source file
6+
loop: boolean; /// whether the video loops the playback after extends
7+
autoplay: boolean; /// set true for the video to start playing when ready
8+
controls: boolean; /// set true to enable the media player's playback controls
9+
_emit: any;
10+
11+
/**
1312
* Start playing the video.
1413
*/
15-
play(): void;
16-
14+
play(): void;
1715

18-
/**
16+
/**
1917
* Pause the currently playing video.
2018
*/
21-
pause(): void;
19+
pause(): void;
2220

23-
24-
/**
21+
/**
2522
* Seek the video to a time.
2623
* @param {number} time - Time of the video to seek to in milliseconds.
2724
*/
28-
seekToTime(time: number): void;
29-
25+
seekToTime(time: number): void;
3026

31-
/**
27+
/**
3228
* Returns the current time of the video duration in milliseconds.
3329
* @returns {number} Current time of the video duration.
3430
*/
35-
getCurrentTime(): number;
36-
31+
getCurrentTime(): number;
3732

38-
/**
33+
/**
3934
* Boolean to determine if observable for current time is registered.
4035
* @param {boolean} observeCurrentTime - True to set observable on current time.
4136
*/
42-
observeCurrentTime(observeCurrentTime: boolean): void;
37+
observeCurrentTime(observeCurrentTime: boolean): void;
4338

44-
45-
/**
39+
/**
4640
* Observable for current time of the video duration in milliseconds.
4741
* @returns {number} Current time of the video duration.
4842
*/
49-
currentTime(): number;
43+
currentTime(): number;
5044

51-
/**
45+
/**
5246
* Set the volume of the video
5347
* @param {number} volume - Volume to set the video between 0 and 1
5448
*/
55-
setVolume(volume: number): void;
49+
setVolume(volume: number): void;
5650

57-
/**
51+
/**
5852
* Destroy the video player and free up resources.
5953
*/
60-
destroy(): void;
61-
54+
destroy(): void;
6255

63-
/**
56+
/**
6457
* Mute and unmute the video.
6558
* @param {boolean} mute - true to mute the video, false to unmute.
6659
*/
67-
mute(mute: boolean): void;
68-
60+
mute(mute: boolean): void;
6961

70-
/**
62+
/**
7163
* Returns the duration of the video in milliseconds.
7264
* @returns {number} Video duration in milliseconds.
7365
*/
74-
getDuration(): number;
66+
getDuration(): number;
7567

76-
77-
/**
68+
/**
7869
* *** ANDROID ONLY ***
7970
* Stop playback of the video. This resets the player and video src.
8071
*/
81-
stop(): void;
82-
72+
stop(): void;
8373

84-
/**
74+
/**
8575
* *** IOS ONLY ***
8676
* Update the video player with an AVAsset file.
8777
*/
88-
updateAsset(asset): void;
78+
updateAsset(asset): void;
8979

90-
/**
80+
/**
9181
* Callback to execute when the video is ready to play
9282
* @param {function} callback - The callback function to execute.
9383
*/
94-
playbackReady(callback: Function): void;
84+
playbackReady(callback: Function): void;
9585

96-
/**
86+
/**
9787
* *** IOS ONLY ***
9888
* Callback to execute when the video is playing.
9989
* @param {function} callback - The callback function to execute.
10090
*/
101-
playbackStart(callback: Function): void;
91+
playbackStart(callback: Function): void;
10292

103-
/**
93+
/**
10494
* Callback to execute when the video has finished seekToTime.
10595
* @param {function} callback - The callback function to execute.
10696
*/
107-
seekToTimeComplete(callback: Function): void;
97+
seekToTimeComplete(callback: Function): void;
10898

109-
/**
99+
/**
110100
* Callback to execute when the time is updated.
111101
* @param {function} callback - The callback function to execute.
112102
*/
113-
currentTimeUpdated(callback: Function): void;
114-
115-
}
103+
currentTimeUpdated(callback: Function): void;
104+
}

videoplayer.ios.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as application from "application";
1+
import * as application from "tns-core-modules/application";
22
import * as common from "./videoplayer-common";
33

44
export * from "./videoplayer-common";

0 commit comments

Comments
 (0)