moust / cordova-plugin-videoplayer Goto Github PK
View Code? Open in Web Editor NEWA Codova plugin to play video with the native MediaPlayer on Android devices.
License: MIT License
A Codova plugin to play video with the native MediaPlayer on Android devices.
License: MIT License
can this use xml playlists?
Hello,
Currently this player is opening a new dialog but is it possible to play video inside a HTML element?
Thanks
Hello,
Is there any chance to hide the status bar (clock, battery, notifications, etc) hile the video is playing?
Thank you !
Hi,
I'm getting this error. I'm loading a remote video:
FAILED pluginJSON = ["VideoPlayer1323011964","VideoPlayer","play",["http://192.168.1.10:8081/aaa12.mov",{"scalingMode":2,"volume":0.5}]]
Hello!! is posible block the button to back hardware of the phone on view video
ionic cordova plugin add https://github.com/moust/cordova-plugin-videoplayer.git
cordova plugin add https://github.com/moust/cordova-plugin-videoplayer.git --save
✖ Running command - failed!
[ERROR] An error occurred while running cordova plugin add https://github.com/moust/cordova-plugin-videoplayer.git
--sav... (exit code 1):
Error: Failed to fetch plugin https://github.com/moust/cordova-plugin-videoplayer.git via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Failed to get absolute path to installed module
I'm running cordova-plugin-videoplayer on Ionic and is not working:
HTML file:
<button class="button button-block button-energized" ng-click="abrir()">Play</button>
Controllers.js
$scope.abrir = function() {
VideoPlayer.play(
"http://techslides.com/demos/sample-videos/small.mp4",
{
volume: 0.5,
scalingMode: VideoPlayer.SCALING_MODE.SCALE_TO_FIT_WITH_CROPPING
},
function () {
console.log("video completed");
},
function (err) {
console.log(err);
}
);
};
Error:
0 564830 error ReferenceError: VideoPlayer is not defined
at Scope.$scope.abrir (http://192.168.0.8:8100/js/controllers.js:485:17)
at fn (eval at compile (http://192.168.0.8:8100/lib/ionic/js/ionic.bundle.js:27638:15), <anonymous>:4:206)
at http://192.168.0.8:8100/lib/ionic/js/ionic.bundle.js:65427:9
at Scope.$eval (http://192.168.0.8:8100/lib/ionic/js/ionic.bundle.js:30395:28)
at Scope.$apply (http://192.168.0.8:8100/lib/ionic/js/ionic.bundle.js:30495:25)
at HTMLButtonElement.<anonymous> (http://192.168.0.8:8100/lib/ionic/js/ionic.bundle.js:65426:13)
at defaultHandlerWrapper (http://192.168.0.8:8100/lib/ionic/js/ionic.bundle.js:16787:11)
at HTMLButtonElement.eventHandler (http://192.168.0.8:8100/lib/ionic/js/ionic.bundle.js:16775:9)
at triggerMouseEvent (http://192.168.0.8:8100/lib/ionic/js/ionic.bundle.js:2953:7)
at tapClick (http://192.168.0.8:8100/lib/ionic/js/ionic.bundle.js:2942:3)
Ionic: 2.1.4
Cordova: 6.4.0
I am using ionic framework. I used this plugin and tried playing a local video with path
file:///storage/2179-1C04/DCIM/Camera/20170816_143027.mp4 but its not playing it gives exception
"Unhandled Promise rejection:", source: file:///android_asset/www/build/polyfills.js
"Error: Uncaught (in promise): Prepare failed.: status=0x1", source: file:///android_asset/www/build/polyfills.js
What's the problem?
I want to be able to play video on both iOS and android. how can i achieve it?
Hi,
Thanks for the plugin!
I'm testing on an android emulator and don't seem to get native controls (play/pause/scrub etc.). Should these be visible? If not is there any way to make them visible?
Many Thanks,
Dan
The plugin fires the completeCallback
even when the device was not capable of playing the file.
In my app, I play a 4k video file. Some older devices can't decode 4k, and the video player opens and closes immediately. The completeCallback is then called, when it should be the errorCallback.
I want to know if the device was capable of playing the 4k file, so I can try playing a 1080p file instead, but since it always says "video completed" I can't make the distinction.
I seem to get VideoPlayer is not defined. I am using the following. Does this work with the latest versions of cordova?
Here is my index.html
http://pastebin.com/u16LXUJp
Here is my index.js
http://pastebin.com/DypKgTKr
Am I missing somehting simple?
NEVER MIND! IT WORKS NOW!
Video does not play. This is my index.html. Is it correct?
< !DOCTYPE html>
< html>
< head>
< meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; media-src *">
< meta name="format-detection" content="telephone=no">
< meta name="msapplication-tap-highlight" content="no">
< meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
< title>Hello World</title>
< script type="text/javascript" src="cordova.js"></script>
< script type="text/javascript" charset="utf-8">
// Wait for device API libraries to load
document.addEventListener("deviceready", onDeviceReady, false);
// device APIs are available
function onDeviceReady() {
}
</script>
</head>
< body>
< div style="margin: 20px;">
< button onclick="play">PLAY VIDEO</button>
</div>
< script>
function play() {
VideoPlayer.play(
"file:///android_asset/www/videos/myvideo-h264.mp4",
{
volume: 0.5,
scalingMode: VideoPlayer.SCALING_MODE.SCALE_TO_FIT
// scalingMode: VideoPlayer.SCALING_MODE.SCALE_TO_FIT_WITH_CROPPING
},
function () {
console.log("video completed");
},
function (err) {
console.log(err);
}
);
alert(VideoPlayer);
}
</script>
< script type="text/javascript" src="js/videoplayer.js"></script>
</body>
My app is locked into portrait mode but the video is landscaped how can I set this fix in the play options?
hi, I am using cordova 6.0.0 CLI and I have installed this plugin to my project through terminal from this source:
https://github.com/moust/cordova-plugin-videoplayer.git
I am calling the videoplayer.play() method on the onclick event listener of a button for test, but nothing happens.
<button onClick="VideoPlayer.play("https://www.youtube.com/watch?v=H-30B0cqh88");">Play me</button>
any help ?
This is a great Cordova plugin thanks for building it!
I'm just trying to get the video to play full width, but not full height, so it's not so stretched. Is this possible?
I've tried both of the scallingMode options, but they still keep the video 100% height and width
The method description on line 21 in README.md uses .get()
is this correct? It doesn't look like this method exists. Shouldn't it be .play()
?
VideoPlayer.get(path, [options], [completeCallback], [errorCallback]);
Hello,
I tried to use this plugin with an Android 6.0 phone but the video is not displayed, although controls of my app such as button, inputs, ... becomes inactive till I click on the 'back button'. It is like the video is transparent.
My video is located on my server and I call the plugin through this command:
VideoPlayer.play('https://myserver.com/files/index.php?type=attachment&line='+$(this).data('id'));
Also I have added <script type="text/javascript" src="js/videoplayer.js"></script>
at the end of my index.html. Lastly, videos are either 3gp or mp4.
What can I do to make it working?
Thanks!
this is good, can you add the close method, thanks
Thanks for the plugin, it's working great. Just wondering would you consider adding a method to close the fullscreen player?
Hello,
When playing a video for the first time, everything works great. when calling .close() function the video closes great. 2nd time around, the .play() is called the same way as the first time. The video plays fine for the second time. Now when trying to close it before the video ends, the app fatally crash.
Any idea why?
Thank you!
is there any plan to develop in ios or winphone ?
iOS version?
I am having problem, video plays and I can hear audio, but screen is just blank? What could be the problem ?
I am using PGB 3.4 with your plugin 1.0.0
this is my code
VideoPlayer.play("https://www.youtube.com/watch?v=jHc3mdIG2AY");
or
VideoPlayer.play(
"https://www.youtube.com/watch?v=jHc3mdIG2AY",
{
volume: 0.5,
scalingMode: VideoPlayer.SCALING_MODE.SCALE_TO_FIT_WITH_CROPPING
},
function (err) {
alert(err); //no alert window appear
}
but no any feedback response...
Hello,
This plugin is useful to play videos saved locally to device / emulator.
My question is i am testing in emulator and my video is in assets/video folder and code is at src/pages folder as per ionic project directory. so what should be path i write in this.videoPlayer.play("HERE",{})
'assets/video/video_0.mp4' is not working.
Thank you
When I am trying to build the apps, I got the following -
Error - The following plugin, plugin version or a dependancy of this plugin is not on npm: [email protected]
Fetching plugin "[email protected]" via npm
Installing "cordova-plugin-statusbar" at "2.1.3" for android
Fetching plugin "[email protected]" via npm
Installing "cordova-plugin-device" at "1.1.2" for android
Fetching plugin "[email protected]" via npm
Installing "cordova-plugin-splashscreen" at "2.1.0" for android
Fetching plugin "[email protected]" via npm
Installing "cordova-plugin-compat" at "1.0.0" for android
Fetching plugin "[email protected]" via npm
Installing "cordova-plugin-file" at "4.2.0" for android
Plugin dependency "[email protected]" already fetched, using that version.
Dependent plugin "cordova-plugin-compat" already installed on android.
The Android Persistent storage location now defaults to "Internal". Please check this plugins README to see if you application needs any changes in its config.xml.
If this is a new application no changes are required.
If this is an update to an existing application that did not specify an "AndroidPersistentFileLocation" you may need to add:
"<preference name="AndroidPersistentFileLocation" value="Compatibility" />"
to config.xml in order for the application to find previously stored files.
Fetching plugin "[email protected]" via npm
Installing "cordova-plugin-file-transfer" at "1.5.1" for android
Plugin dependency "[email protected]" already fetched, using that version.
Dependent plugin "cordova-plugin-file" already installed on android.
Fetching plugin "[email protected]" via npm
Installing "cordova-plugin-camera" at "2.2.0" for android
Plugin dependency "[email protected]" already fetched, using that version.
Dependent plugin "cordova-plugin-compat" already installed on android.
Fetching plugin "[email protected]" via npm
Installing "cordova-plugin-dialogs" at "1.2.1" for android
Fetching plugin "https://github.com/tanelih/phonegap-bluetooth-plugin.git" via git clone
Using shallow clone
Repository "https://github.com/tanelih/phonegap-bluetooth-plugin.git" checked out to git ref "master" at "b63bb9e".
Installing "com.phonegap.plugins.bluetooth" at "0.9" for android
Fetching plugin "[email protected]" via npm
Installing "cordova-plugin-media" at "2.3.0" for android
Plugin dependency "[email protected]" already fetched, using that version.
Dependent plugin "cordova-plugin-file" already installed on android.
Plugin dependency "[email protected]" already fetched, using that version.
Dependent plugin "cordova-plugin-compat" already installed on android.
"plugman-151 install --platform android --project /project --plugin [email protected] --nohooks=.": Fetching plugin "[email protected]" via npm
Failed to fetch plugin [email protected] via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: Registry returned 404 for GET on https://registry.npmjs.org/com.moust.cordova.videoplayer
Is it possible to be able to specify an onCompletion callback?
When i try install this plugin, this error appear:
Failed to restore plugin "com.moust.cordova.videoplayer" from config.xml. You might need to try adding it again. Error: Failed to fetch plugin com.moust.cordova.videoplayer@https://github.com/moust/cordova-plugin-videoplayer via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Failed to get absolute path to installed module
Can you help me ?
info:
node : v6.10.3
cordova: 7.0.1
ionic: 3.2.0
OS: MACOSX
Trying to install, this error happens:
Error: Failed to fetch plugin com.moust.cordova.videoplayer via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: Registry returned 404 for GET on https://registry.npmjs.org/com.moust.cordova.videoplayer
cordova version 6.0.0
xcode 7.2.1
mac os x el capitan
how could i embed .srt subtitle to this video ?
Thanks
First of all thanks for your greate work!
When the video starts out of my phonegap app the title and menu bar appear and on end they disappear.
Is it possible to hide them by default?
i trying to view a video use my device (Specs: Android 7), i was config all, but to click in the button for play video nothing happens.
in what android version you was testing plugin?
thanks and regards!
In VLC I write this URL rtsp://--login--:[email protected]:554 and everything appears fine, but when I write in my code
document.addEventListener('deviceready', function() { VideoPlayer.play( "rtsp://--login--:[email protected]:554", { volume: 0.5 }, function () { alert("video completed"); }, function (err) { alert(err); } ); ... }
alert tells me "Prepare failed: status = 0x1". Does the plugin RTSP?
Hi there !
Thank's for you usefull plugin.
I installed it with the following command line
cordova plugin add com.moust.cordova.videoplayer
and unfortunately ran into some issue trying to call VideoPlayer.close().
Finally I figured out that the version installed via the latter command line wasn't featuring the close() method.
I reinstalled it via
cordova plugin add https://github.com/moust/cordova-plugin-videoplayer.git
an it solved my issue.
the plugin is not available via plugin resgitry
Hello,
Is it possible to add preloading dialog before function is done ? I try many ways but still not success.
Please suggest.
Thank you,
Umpol
Hello,
I like your plugin but I stuck while using SCALING_MODE option.
I tried following code:
import { VideoPlayer } from '@ionic-native/video-player'; . . . this.videoPlayer.play("https://www.quirksmode.org/html5/videos/big_buck_bunny.mp4",{ scalingMode: VideoPlayer.SCALING_MODE.SCALE_TO_FIT_WITH_CROPPING }).then(() => { console.log('video completed'); this.videoPlayer.close(); }).catch(err => { console.log(err); });
but I got error:
Property 'SCALING_MODE' does not exist on type 'typeof VideoPlayer'.
I can play video without providing any option though.
Thanks,
Bhavin
I make sure that I add the plugin in my program. but when I start it on browser, there is a error :Error: exec proxy not found for :: VideoPlayer :: play. Can you help me?
I ran the command " cordova plugin add cordova-plugin-video-player " and gives me the following error:
(node:4008) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejec
tion id: 1): Error: cmd: Command failed with exit code ENOENT
(node:4008) [DEP0018] DeprecationWarning: Unhandled promise rejections are depre
cated. In the future, promise rejections that are not handled will terminate the
Node.js process with a non-zero exit code.
command " ionic info " shows :
cli packages: (C:\Users\shweta\AppData\Roaming\npm\node_modules)
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@ionic/app-scripts : 3.1.8
Cordova Platforms : none
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.0.1
Node : v9.2.0
npm : 5.8.0
OS : Windows 8.1
Environment Variables:
ANDROID_HOME : C:\Users\shweta\AppData\Local\Android\sdk
Misc:
backend : pro
Please help me out.
"Uncaught ReferenceError: VideoPlayer is not defined", source: file:///android_asset/www/js/videos.js (9)
After integration into project i am getting this error.
hi @moust
I saw your plugin under PGB
https://build.phonegap.com/plugins/813
https://github.com/moust/cordova-plugin-videoplayer/blob/7129007f4f6361412cf8a0aa5412885c6478dab8/README.md
Q1
is this plugin a fork one ? because of your plugin is almost similar like this...
https://build.phonegap.com/plugins/391
https://github.com/dawsonloudon/VideoPlayer
Q2
what's the difference between by yours and the orginal,I think is,that you add two attribute,"volume" and "scalingMode"
https://github.com/moust/cordova-plugin-videoplayer/blob/7129007f4f6361412cf8a0aa5412885c6478dab8/README.md
well~
is the volume value set in this Range (0.0 to 1.0)?
is the scalingMode's value only set in this ?
VideoPlayer.SCALING_MODE.SCALE_TO_FIT_WITH_CROPPING
or any other value can be set ?
When I try to execute:
cordova plugin add com.moust.cordova.videoplayer
It returns the following error:
Error: 404 Not Found: com.moust.cordova.videoplayer
Any ideas?
How can i show overlay image on top of playing video which is playing full screen. I would also like to know how can i change size of player because currently it only plays fullscreen
this plugin is supporting both no-fullscreen and fullscreen?
I need video playing as no-fullscreen when portrait mode and full screen when rotate as landscape mode like youtube/vimeo player.
Regards
I'm trying to use this plugin but I keep getting this error seemingly randomly. I have 7 videos I need to play in a row and some will play with no error and others will have this error. Its not the same videos either. Sometimes the first video plays sometimes it doesn't. What I find from Googling is that its a generic error that is thrown when an unknown error occurred. Any ideas on what could be causing this?
03-27 13:55:38.440 31798-31811/com.tsi.fitpro V/MediaPlayer: New video size 1920 x 1080
03-27 13:55:38.440 31798-31811/com.tsi.fitpro V/MediaPlayer: callback application
03-27 13:55:38.440 31798-31811/com.tsi.fitpro V/MediaPlayer: back from callback
03-27 13:55:38.440 31798-31808/com.tsi.fitpro V/MediaPlayer: message received msg=1, ext1=0, ext2=0
03-27 13:55:38.440 31798-31808/com.tsi.fitpro V/MediaPlayer: prepared
03-27 13:55:38.440 31798-31808/com.tsi.fitpro V/MediaPlayer: callback application
03-27 13:55:38.440 31798-31808/com.tsi.fitpro V/MediaPlayer: back from callback
03-27 13:55:38.500 31798-31798/com.tsi.fitpro V/MediaPlayer: setVideoSurfaceTexture
03-27 13:55:38.560 31798-31798/com.tsi.fitpro E/MediaPlayer: Should have subtitle controller already set
03-27 13:55:38.560 31798-31798/com.tsi.fitpro W/MediaPlayer: this is IMEDIA_PLAYER_VIDEO_EXIST
03-27 13:55:38.560 31798-31798/com.tsi.fitpro I/MediaPlayer: sendBroadcast android.media.IMediaPlayer.videoexist
03-27 13:55:38.570 31798-31798/com.tsi.fitpro V/MediaPlayer-JNI: start
03-27 13:55:38.570 31798-31798/com.tsi.fitpro V/MediaPlayer: start
03-27 13:55:38.590 31798-31811/com.tsi.fitpro V/MediaPlayer: message received msg=100, ext1=1, ext2=-1021
03-27 13:55:38.590 31798-31811/com.tsi.fitpro E/MediaPlayer: error (1, -1021)
03-27 13:55:38.590 31798-31811/com.tsi.fitpro V/MediaPlayer: callback application
03-27 13:55:38.590 31798-31811/com.tsi.fitpro V/MediaPlayer: back from callback
03-27 13:55:38.600 31798-31808/com.tsi.fitpro V/MediaPlayer: message received msg=6, ext1=0, ext2=0
03-27 13:55:38.600 31798-31808/com.tsi.fitpro V/MediaPlayer: Received MEDIA_STARTED
03-27 13:55:38.600 31798-31808/com.tsi.fitpro V/MediaPlayer: callback application
03-27 13:55:38.600 31798-31808/com.tsi.fitpro V/MediaPlayer: back from callback
03-27 13:55:38.620 31798-31798/com.tsi.fitpro E/MediaPlayer: Error (1,-1021)
03-27 13:55:38.620 31798-31798/com.tsi.fitpro E/VideoPlayer: MediaPlayer.onError(1, -1021)
Hi,
I have getting following error with "npm install"
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! code E404
npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/com.moust.cordova.videoplayer
npm ERR! 404
npm ERR! 404 'com.moust.cordova.videoplayer' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'MUS_Video'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
Hi, this plugin is very nice. Showing your plugin until now you support only playing a file, do you think you could supporting also playing a live stream like an rtsp stream?
Hello,
Just discovered this plugin ! Please could you tell me which platforms are supported ?
(i'm interested in IOS and Android)
Thank !
Frédéric
The readme did not state if it supports YouTube video streaming. I would like to confirm that.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.