Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70448

Display video from media capture plugin

$
0
0

@lcatania wrote:

Hey,

im currently struggling to implement a video playback and would love to get some help.

My current situation:

Iam using the MediaCapturePlugin to capture a video after i got the video i create a SafeResourceUrl/SafeUrl from the fullPath property and bind the property to a video element. The problem is that the video is not loading and i get the error. Not allowed to load local resources.

Did someone had any similar issues.

Here is my implementation:

Function to access the camera

 // Cordova media capture plugin
  public async getCameraVideo() {
    const options: CaptureVideoOptions = { limit: 1 };
    const video = await this.mediaCapture.captureVideo(options);
    return video[0];
  }

Function that generates the binding property

async selectNewVideo() {
        this.selectedMedia = undefined;
        const video = await this.mediaCaptureService.getCameraVideo();
        this.selectedMedia = { format: 'audio', isPlaceholder: false, src: video.localURL, safeSrc: this.sanitizer.bypassSecurityTrustResourceUrl(video.fullPath) } as MediaStorageItem;
    }

Video element

<video controls=“controls” [src]=“selectedMedia?.safeSrc”>

Thanks in advantage

Best Regards

Lorenzo

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70448

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>