Playing mp4 videos that are stored locally on the device


#1

Hi Ionic developers, I have a need to play mp4 videos that are stored on the physical iOS/Andriod device. The total size of the videos are 1.2 GB on an iOS device. Is there a way to play the videos using Ionic plugins like ngCordova plugins? I didn’t find ngCordova plugins that provide the functionality of what I need.

Thought process is to package videos with iOS/Android build. I don’t want the user to have to download 1.2 plus GBs of video. Option of access videos from the cloud (AWS S3) is not an option. Too many existing users. The cost of the bandwidth is high.


#2

So if you don’t want to bundle the videos in the app, how do you intend to get the video on the device?


#3

Let me clarify, I don’t want the users to download the videos from the web. I have an several apps that are in the iTunes store that contain the videos. When a user purchases the app, the videos that come with it are downloaded.

As I am looking to use PhoneGap or Ionic, how can I play the videos that are locally stored in the app (which are downloaded when the app is downloaded).


#4

Hi,

I have exactly the same problem. I have about 10 videos (10MB each).
I have to include those vids into application. My android device has only internal storage not sdcard.
Playing video online is not an option. It has to be stored in tablet internal storage due to missing internet connection.
I have this root folder: /myApp/www/
and this is the src of my video tag" /videos/category/video01.mp4
Its not working at all. I tried a lot of tutorials on how to do it.
Someone says that this have to be required: (its inside AndroidManifest.xml)

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<manifest android:hardwareAccelerated="true" .......>

Nothing happened.
Im trying to open the video inside ionic modal, modal shows up,
player shows too but nothing happend when I click play.
I tried video sources:

/video/category/video01.mp4
file:///video/category/video01.mp4
/android_asset/www/videos/category/video01.mp4
file:///android_asset/www/videos/category/video01.mp4

Nothing work for me.
If the video source is somewhere on server than it works fine. (but I cant do it this way)
Please If someone can help me (and many other people) I will pay for working solution.
I spent so much time on this “I think” bug without success. Im relatively new, its my first ionic/angularjs application.
I can send source code by mail. My mail is jiri.bakes(at)gmail.com

Many thanks for any advice.
Im looking forward for answers.


#5

Hi,

You should try to use this plugin https://github.com/jaeger25/Html5Video
and make sure to put the videos in /platforms/android/res/raw


#6

Hi,

I solved all my problems with localy stored videos with crosswalk.
Here is a link: http://ionicframework.com/docs/cli/browsers.html
Now everything works fine.


#7

you need to put the videos in the assets folder, so that when the application compiles or build it automatically resides inside the application and u can access it from there.


#8

Please ensure your link to be working.:slight_smile: