-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1520 from sultanmyrza/feature-try-2-play-go-pro-v…
…ideos-with-native-players Feature try 2 play go pro videos with native players
- Loading branch information
Showing
17 changed files
with
168 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<ion-button (click)="dismiss()" color="light" fill="clear" class="dismiss"> | ||
<ion-icon name="arrow-back-outline" slot="icon-only"></ion-icon> | ||
</ion-button> | ||
|
||
<p>go-pro-media-viewer-with-native-player</p> |
15 changes: 15 additions & 0 deletions
15
...pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
:host { | ||
background-color: black; | ||
} | ||
|
||
.dismiss { | ||
position: absolute; | ||
left: 0; | ||
z-index: 1; | ||
width: 48px; | ||
height: 48px; | ||
|
||
--border-radius: 50%; | ||
--padding-end: 0; | ||
--padding-start: 0; | ||
} |
28 changes: 28 additions & 0 deletions
28
...-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; | ||
import { IonicModule } from '@ionic/angular'; | ||
|
||
import { GoProMediaViewerWithNativePlayerComponent } from './go-pro-media-viewer-with-native-player.component'; | ||
|
||
describe('GoProMediaViewerWithNativePlayerComponent', () => { | ||
let component: GoProMediaViewerWithNativePlayerComponent; | ||
let fixture: ComponentFixture<GoProMediaViewerWithNativePlayerComponent>; | ||
|
||
beforeEach( | ||
waitForAsync(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [GoProMediaViewerWithNativePlayerComponent], | ||
imports: [IonicModule.forRoot()], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent( | ||
GoProMediaViewerWithNativePlayerComponent | ||
); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}) | ||
); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
52 changes: 52 additions & 0 deletions
52
...o-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { Component, OnDestroy, OnInit } from '@angular/core'; | ||
import { ActivatedRoute, Router } from '@angular/router'; | ||
import { NavController } from '@ionic/angular'; | ||
import { PreviewVideo } from '@numbersprotocol/preview-video'; | ||
import { GoProFile } from '../go-pro-media-file'; | ||
|
||
@Component({ | ||
selector: 'app-go-pro-media-viewer-with-native-player', | ||
templateUrl: './go-pro-media-viewer-with-native-player.component.html', | ||
styleUrls: ['./go-pro-media-viewer-with-native-player.component.scss'], | ||
}) | ||
export class GoProMediaViewerWithNativePlayerComponent | ||
implements OnInit, OnDestroy | ||
{ | ||
mediaFile: GoProFile | undefined; | ||
|
||
onIOSPlayerDismissedListener?: any; | ||
|
||
constructor( | ||
private readonly route: ActivatedRoute, | ||
private readonly router: Router, | ||
private readonly navController: NavController | ||
) { | ||
this.route.queryParams.subscribe(_ => { | ||
const state = this.router.getCurrentNavigation()?.extras.state; | ||
if (state) { | ||
this.mediaFile = state.goProMediaFile; | ||
} | ||
}); | ||
} | ||
|
||
ngOnInit(): void { | ||
if (!this.mediaFile?.url) return; | ||
PreviewVideo.playFullScreenFromRemote({ url: this.mediaFile.url }); | ||
PreviewVideo.addListener('iosPlayerDismissed', (_info: any) => { | ||
// eslint-disable-next-line no-console | ||
console.log('ITS WORKING'); | ||
this.navController.back(); | ||
}); | ||
} | ||
|
||
ngOnDestroy(): void { | ||
PreviewVideo.stopFullScreen(); | ||
// TODO: check if .remove() really get called | ||
this.onIOSPlayerDismissedListener?.remove(); | ||
} | ||
|
||
dismiss() { | ||
PreviewVideo.stopFullScreen(); | ||
this.navController.back(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters