How to display a list of videos in ionic 3

Viewed 5725

How do i display a list of videos from my server using ionic. The video tag doesnt seem to work on ionic. When used, the videos dont seem to show up. This is how am using the video tag:

<video>
   <source="theurlofthevideo.mp4" type="type/mp4">
</video>

What seems to be the issue. Doesnt work in the browser and on android as well.

1 Answers

You can do it as shown below.

Note: This is just a sample.Convert it to your use case.

<ion-content overflow-scroll="true">
  <video controls="controls" preload="metadata" autoplay="autoplay" webkit-playsinline="webkit-playsinline" class="videoPlayer">
   <source src="./assets/videos/Part_1.mp4" type="video/mp4" />
  </video>
</ion-content>

Working sample: codepen

And also I would like to recommend to use native video Player plugin for that.

A Cordova plugin that simply allows you to immediately play a video in fullscreen mode.

ionic cordova plugin add https://github.com/moust/cordova-plugin-videoplayer.git 
npm install --save @ionic-native/video-player
Related