@nstudio/nativescript-exoplayer
Advanced tools
Comparing version 6.1.1 to 6.2.0
@@ -48,2 +48,7 @@ import { Video as VideoBase } from './common'; | ||
play(): void; | ||
getPlayer(): com.google.android.exoplayer2.ExoPlayer; | ||
getVideoSize(): { | ||
width: number; | ||
height: number; | ||
}; | ||
pause(): void; | ||
@@ -50,0 +55,0 @@ mute(mute: any): void; |
@@ -150,2 +150,8 @@ /* eslint-disable @typescript-eslint/no-inferrable-types */ | ||
/* required in listener implementation */ | ||
const owner = that.get(); | ||
if (!owner) { | ||
return; | ||
} | ||
owner.videoWidth = _videoSize.width; | ||
owner.videoHeight = _videoSize.height; | ||
}, | ||
@@ -390,2 +396,11 @@ onSurfaceSizeChanged: function (_width, _height) { | ||
} | ||
getPlayer() { | ||
return this.player; | ||
} | ||
getVideoSize() { | ||
return { | ||
width: this.videoWidth, | ||
height: this.videoHeight, | ||
}; | ||
} | ||
pause() { | ||
@@ -493,4 +508,6 @@ if (this.player) { | ||
// this.release(); | ||
this._resumeOnFocusGain = this.player.isPlaying(); | ||
this.player.setPlayWhenReady(false); | ||
if (this.player) { | ||
this._resumeOnFocusGain = this.player.isPlaying(); | ||
this.player.setPlayWhenReady(false); | ||
} | ||
} | ||
@@ -497,0 +514,0 @@ resumeEvent() { |
@@ -149,2 +149,13 @@ import { View } from '@nativescript/core'; | ||
/** | ||
* Get the video size | ||
* @returns {object<width: number, height: number>} | ||
*/ | ||
getVideoSize(): { width: number; height: number }; | ||
/** | ||
* Get the native player instance. | ||
*/ | ||
getPlayer(): AVPlayer | com.google.android.exoplayer2.ExoPlayer; | ||
/** | ||
* *** IOS ONLY *** | ||
@@ -151,0 +162,0 @@ * Update the video player with an AVAsset file. |
@@ -31,2 +31,4 @@ import { Video as VideoBase } from './common'; | ||
play(): void; | ||
getPlayer(): AVPlayer; | ||
getVideoSize(): CGSize; | ||
pause(): void; | ||
@@ -33,0 +35,0 @@ mute(mute: boolean): void; |
@@ -25,3 +25,2 @@ import { Application, Utils } from '@nativescript/core'; | ||
} | ||
; | ||
export class Video extends VideoBase { | ||
@@ -226,2 +225,11 @@ constructor() { | ||
} | ||
getPlayer() { | ||
return this._player; | ||
} | ||
getVideoSize() { | ||
if (this._player) { | ||
const size = this._player.currentItem.presentationSize; | ||
return size; | ||
} | ||
} | ||
pause() { | ||
@@ -392,3 +400,3 @@ if (this._player) { | ||
if (path === 'status') { | ||
if (this['_owner']._player.currentItem.status === AVPlayerItemStatus.ReadyToPlay && !this['_owner']._videoLoaded) { | ||
if (this['_owner']._player && this['_owner']._player.currentItem.status === AVPlayerItemStatus.ReadyToPlay && !this['_owner']._videoLoaded) { | ||
this['_owner'].playbackReady(); | ||
@@ -395,0 +403,0 @@ } |
{ | ||
"name": "@nstudio/nativescript-exoplayer", | ||
"version": "6.1.1", | ||
"version": "6.2.0", | ||
"description": "NativeScript plugin that uses the ExoPlayer video player on Android and AVPlayerViewController on iOS to play local and remote videos.", | ||
@@ -5,0 +5,0 @@ "main": "index", |
@@ -174,2 +174,4 @@ # @nstudio/nativescript-exoplayer | ||
- **setVolume()** - Set the volume - Must be between 0 and 1. | ||
- **getVideoSize()** - On iOS, this will return the size of the presentation layer and on Android, the size of the player view | ||
- **getPlayer()** - get the native Player instance | ||
@@ -176,0 +178,0 @@ ### Android only |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
137494
1832
229