Skip to content

Commit 11c83e6

Browse files
authored
Merge pull request #1520 from sultanmyrza/feature-try-2-play-go-pro-videos-with-native-players
Feature try 2 play go pro videos with native players
2 parents a98da47 + 3dc9cec commit 11c83e6

17 files changed

+168
-10
lines changed

android/app/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ android {
1010
versionName "0.54.1"
1111
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1212
}
13+
buildFeatures {
14+
dataBinding true
15+
}
1316
buildTypes {
1417
release {
1518
minifyEnabled false

android/app/capacitor.build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ dependencies {
2525
implementation project(':capacitor-share')
2626
implementation project(':capacitor-splash-screen')
2727
implementation project(':capacitor-storage')
28+
implementation project(':numbersprotocol-preview-video')
2829
implementation project(':capacitor-blob-writer')
2930

3031
}

android/app/src/main/assets/capacitor.plugins.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@
6363
"pkg": "@capacitor/storage",
6464
"classpath": "com.capacitorjs.plugins.storage.StoragePlugin"
6565
},
66+
{
67+
"pkg": "@numbersprotocol/preview-video",
68+
"classpath": "io.numbersprotocol.capturelite.plugins.previewvideo.PreviewVideoPlugin"
69+
},
6670
{
6771
"pkg": "capacitor-blob-writer",
6872
"classpath": "com.equimaps.capacitorblobwriter.BlobWriter"

android/capacitor.settings.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,8 @@ project(':capacitor-splash-screen').projectDir = new File('../node_modules/@capa
5050
include ':capacitor-storage'
5151
project(':capacitor-storage').projectDir = new File('../node_modules/@capacitor/storage/android')
5252

53+
include ':numbersprotocol-preview-video'
54+
project(':numbersprotocol-preview-video').projectDir = new File('../node_modules/@numbersprotocol/preview-video/android')
55+
5356
include ':capacitor-blob-writer'
5457
project(':capacitor-blob-writer').projectDir = new File('../node_modules/capacitor-blob-writer/android')

ios/App/Podfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def capacitor_pods
2525
pod 'CapacitorShare', :path => '../../node_modules/@capacitor/share'
2626
pod 'CapacitorSplashScreen', :path => '../../node_modules/@capacitor/splash-screen'
2727
pod 'CapacitorStorage', :path => '../../node_modules/@capacitor/storage'
28+
pod 'NumbersprotocolPreviewVideo', :path => '../../node_modules/@numbersprotocol/preview-video'
2829
pod 'CapacitorBlobWriter', :path => '../../node_modules/capacitor-blob-writer'
2930
end
3031

package-lock.json

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"@ngx-formly/core": "^5.10.22",
5858
"@ngx-formly/material": "^5.10.22",
5959
"@ngx-formly/schematics": "^5.10.22",
60+
"@numbersprotocol/preview-video": "github:numbersprotocol/preview-video",
6061
"async-mutex": "^0.3.2",
6162
"buffer": "^5.7.1",
6263
"capacitor-blob-writer": "^1.0.4",

src/app/features/settings/go-pro/go-pro-media-item-detail-on-camera/go-pro-media-item-detail-on-camera.component.html

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@
1515
loading="lazy"
1616
></ion-img>
1717

18-
<video
19-
*ngIf="mediaType === 'video'"
20-
controls
21-
playsinline
22-
preload="metadata"
23-
>
24-
<source src="{{ mediaFile!.url }}#t=0.1" type="video/mp4" />
25-
Your browser does not support the video tag.
26-
</video>
18+
<div class="video-placeholder" (click)="playVideoFullScreen()">
19+
<div class="play-icon"></div>
20+
<ion-img
21+
*ngIf="mediaType === 'video'"
22+
[src]="mediaFile!.thumbnailUrl"
23+
decoding="async"
24+
loading="lazy"
25+
></ion-img>
26+
<mat-icon class="play-icon">play_circle_outline</mat-icon>
27+
</div>
2728

2829
<div class="spacer"></div>
2930
<ion-button

src/app/features/settings/go-pro/go-pro-media-item-detail-on-camera/go-pro-media-item-detail-on-camera.component.scss

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@ ion-img {
22
height: 350px;
33
}
44

5+
.video-placeholder {
6+
height: 350px;
7+
position: relative;
8+
}
9+
10+
.play-icon {
11+
position: absolute;
12+
left: 0;
13+
right: 0;
14+
top: 175px; // half of video-placeholder height
15+
transform: translateY(-36px); // half of play-icon height
16+
margin: 0 auto;
17+
font-size: 72px;
18+
height: 72px;
19+
width: 72px;
20+
}
21+
522
video {
623
background-color: black;
724
width: 100%;

src/app/features/settings/go-pro/go-pro-media-item-detail-on-camera/go-pro-media-item-detail-on-camera.component.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ export class GoProMediaItemDetailOnCameraComponent implements OnInit {
4646
this.mediaType = getFileType(this.mediaFile?.url);
4747
}
4848

49+
// eslint-disable-next-line class-methods-use-this
50+
playVideoFullScreen() {
51+
this.router.navigate(['/settings', 'go-pro', 'media-item-viewer'], {
52+
state: { goProMediaFile: this.mediaFile },
53+
});
54+
}
55+
4956
async uploadToCapture() {
5057
const allowed = await this.allowUploadWithMobileInternet();
5158
if (allowed) {

0 commit comments

Comments
 (0)