moust / cordova-plugin-videoplayer

A Codova plugin to play video with the native MediaPlayer on Android devices.
MIT License
139 stars 103 forks source link

File path to local video #62

Open NashIlli opened 5 years ago

NashIlli commented 5 years ago

I dont kown where I have to locate my local videos and how I have to write the path to play my video in my Ionic Project.

Thanks for all!

riadapsis commented 5 years ago

Hi, Try - file:///storage/emulated/0/YOUR_FOLDER/YOUR_FILE

cr1pt0r0 commented 5 years ago

Hi,

If your video path on ionic is as below, for eg. /src/assets/video/test.mp4

Then, your code to access to that video is:- file:///android_asset/www/assets/video/test.mp4

Alkashi commented 3 years ago

Hi,

If your video path on ionic is as below, for eg. /src/assets/video/test.mp4

Then, your code to access to that video is:- file:///android_asset/www/assets/video/test.mp4

Hi,

It is not working for me :/ No error msg on the console. It works fine with a hosted video file but impossible to play a local file embeded on the app.

Does someone have an idea of the correct path to set ? (I am using capacitor & ionic 4)

cr1pt0r0 commented 2 years ago

Hi, If your video path on ionic is as below, for eg. /src/assets/video/test.mp4 Then, your code to access to that video is:- file:///android_asset/www/assets/video/test.mp4

Hi,

It is not working for me :/ No error msg on the console. It works fine with a hosted video file but impossible to play a local file embeded on the app.

Does someone have an idea of the correct path to set ? (I am using capacitor & ionic 4)

Hello, somehow it didn't work for me at first, but after trying something out, it works fine now.

Here's what I did, but not sure which one fixed it.

  1. I installed Android SDK 30.0.3 (Min. requirement for latest plugin build requirement) and 32.0.0 (Just in case).
  2. Remove current android - "ionic cordova platform rm android"
  3. Install latest android - "ionic cordova platform add android@latest"

Then I rebuild my APK, it works fine now. I noticed that the latest android version has a different config in its Android "build.gradle" file.

People suggesting this, (Project folder -> platforms -> android -> build.gradle and then change defaultCompileSdkVersion to 30 instead 29.) will bypass the build, but not sure if it will make the plugin works.

Ernesto-Lorenzo12 commented 1 year ago

Hi Guys Im kind of new to cordova and I know this an old post,

Im trying to play a local video on my app using an HTML5 tag but it seems the seekbar is not working so I ended up using this plugin but unfortunately I'm having an error,

[INFO:CONSOLE(2)] "Uncaught ReferenceError: VideoPlayer is not defined", source: https://localhost/main.js (2)

<button id="MyButton" onclick="playVideo()">Play video</button>

JS File: function playVideo() { VideoPlayer.play( "file:///android_asset/www/assets/dummy-video.mp4", { volume: 0.5, scalingMode: VideoPlayer.SCALING_MODE.SCALE_TO_FIT_WITH_CROPPING }, function () { console.log("video completed"); }, function (err) { console.log(err); } ); }