Skip to content

Commit

Permalink
PDF player issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
nidhikachhawa24 committed Jun 3, 2024
1 parent 79bbfcc commit 500d59f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
11 changes: 6 additions & 5 deletions src/app/pages/home/home.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,12 @@ export class HomePage implements OnInit, OnTabViewWillEnter, OnDestroy {
this.configContents.forEach(cont => {
cont.play = false;
})
if (content?.metaData?.url.endsWith(".pdf")) {
window.open(content?.metaData?.url, "_blank");
} else {
await this.router.navigate(['/player'], { state: { content } });
}
await this.router.navigate(['/player'], { state: { content } });
// if (content?.metaData?.url.endsWith(".pdf")) {
// window.open(content?.metaData?.url, "_blank");
// } else {
// await this.router.navigate(['/player'], { state: { content } });
// }
// if(content.metaData.mimetype !== PlayerType.YOUTUBE) {
// await this.router.navigate(['/player'], { state: { content } });
// } else {
Expand Down
4 changes: 2 additions & 2 deletions src/app/pages/player/player.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<ion-icon name="close"></ion-icon>
</ion-fab-button>
</ion-fab>
<!-- <div #pdf class="pdf-player" *ngIf="playerType==='pdf'"></div> -->
<div #pdf class="pdf-player" *ngIf="playerType==='pdf'"></div>

<div #video class="video-player" *ngIf="playerType==='video'"></div>

Expand All @@ -18,7 +18,7 @@
</div>
</div>

<div *ngIf="playerType==='link' || playerType==='pdf' ">
<div *ngIf="playerType==='link'">
<iframe
[src]="srcUrl"
title="External Website"
Expand Down
4 changes: 2 additions & 2 deletions src/app/services/api/http.capacitor.adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ export class HttpCapacitorAdapter implements HttpClient {

if (mediaUrl.endsWith(".mp3")) {
return 'audio/mp3' ; // // MP3 audio
// } else if (mediaUrl.endsWith(".pdf")) {
// return 'application/pdf'; // PDF document
} else if (mediaUrl.endsWith(".pdf")) {
return 'application/pdf'; // PDF document
} else if (mediaUrl.includes("youtube.com") || mediaUrl.includes("youtu.be")) {
return 'video/x-youtube'; // // YouTube video
} else if (mediaUrl.endsWith(".mp4")) {
Expand Down

0 comments on commit 500d59f

Please sign in to comment.