play video

This commit is contained in:
CHIEFSOFT\ameye
2024-07-14 13:31:48 -04:00
parent 139bc3b21a
commit 27332096c0
2 changed files with 42 additions and 32 deletions
+35 -24
View File
@@ -18,36 +18,47 @@
<source src={{current_media}} type="video/mp4" />
</video>
<video
controls="controls"
preload="metadata"
style="width: 100%; height: auto;">
<source src={{current_media}} type="video/mp4" />
</video>
<!-- <video-->
<!-- controls="controls"-->
<!-- preload="metadata"-->
<!-- style="width: 100%; height: auto;">-->
<!-- <source src={{current_media}} type="video/mp4" />-->
<!-- </video>-->
<video [muted]="true"
style="width: 100%; height: auto;"
loop="loop"
muted
[controls]="true"
#video
src={{current_media}}
></video>
<!-- <video [muted]="true"-->
<!-- style="width: 100%; height: auto;"-->
<!-- loop="loop"-->
<!-- muted-->
<!-- [controls]="true"-->
<!-- #video-->
<!-- src={{current_media}}-->
<!-- ></video>-->
<video [muted]="true"
style="width: 100%; height: auto;"
loop="loop"
muted
[controls]="true"
#video2
src={{current_media}}
></video>
<!-- <video [muted]="true"-->
<!-- style="width: 100%; height: auto;"-->
<!-- loop="loop"-->
<!-- muted-->
<!-- [controls]="true"-->
<!-- #video2-->
<!-- src={{current_media}}-->
<!-- ></video>-->
<div class="boxed_contents">
<ion-button fill="outline" (click)="playVideo()">Play Video</ion-button>
<div style="width: 100%; text-align: right; padding: 5px;">
<ion-button *ngIf="showPlay==true;"
size="small"
fill="outline"
(click)="playVideo()">Play Video</ion-button>
<ion-card>
<ion-button *ngIf="showPlay==false;"
size="small"
fill="outline"
(click)="stopVideo()">Stop Video</ion-button>
</div>
<ion-card style="margin: 0px; background-color: aliceblue;">
<ion-card-header>
<ion-card-subtitle>{{groundDetail.spec.title}}</ion-card-subtitle>
</ion-card-header>
@@ -20,8 +20,8 @@ current_media:string = '';
private wrenchService: WrenchService,
) {
this.groundDetail = this.router.getCurrentNavigation().extras.state;
//this.current_media = this.groundDetail.spec.media;
this.current_media = "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4";
this.current_media = this.groundDetail.spec.media;
// this.current_media = "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4";
}
ngOnInit() {
@@ -32,17 +32,16 @@ current_media:string = '';
@ViewChild('video') myVideo: ElementRef;
showPlay:boolean= true;
playVideo(){
this.myVideo.nativeElement.src = this.current_media;
alert( this.myVideo.nativeElement.src) ;
this.myVideo.nativeElement.load();
//alert( this.myVideo.nativeElement.src) ;
//this.myVideo.nativeElement.load();
this.myVideo.nativeElement.play();
this.showPlay= false;
}
stopVideo(){
this.showPlay= true;
this.myVideo.nativeElement.pause();
}
}