Cordova Streaming Media plugin
For iOS and Android, by Nicholas Hutchind
Description
This plugin allows you to stream audio and video in a fullscreen, native player on iOS and Android.
- 1.0.0 Works with Cordova 3.x
- 1.0.1+ Works with Cordova >= 4.0
Message from the maintainer:
I no longer contribute to Cordova or Ionic full time. If your org needs work on this plugin please consider funding it and hiring me for improvements or otherwise consider donating your time and submitting a PR for whatever you need fixed. My contact info can be found here.
Installation
cordova plugin add https://github.com/nchutchind/cordova-plugin-streaming-media
iOS specifics
- Uses the AVPlayerViewController
- Tested on iOS 12 or later
Android specifics
- Uses VideoView and MediaPlayer.
- Creates two activities in your AndroidManifest.xml file.
- Tested on Android 4.0+
Usage
var videoUrl = STREAMING_VIDEO_URL;
window.plugins.streamingMedia.playVideo(videoUrl);
var options = {
successCallback: function() {
console.log("Video was closed without error.");
},
errorCallback: function(errMsg) {
console.log("Error! " + errMsg);
},
orientation: 'landscape',
shouldAutoClose: true,
controls: true
};
window.plugins.streamingMedia.playVideo(videoUrl, options);
var audioUrl = STREAMING_AUDIO_URL;
window.plugins.streamingMedia.playAudio(audioUrl);
var options = {
bgColor: "#FFFFFF",
bgImage: "<SWEET_BACKGROUND_IMAGE>",
bgImageScale: "fit",
initFullscreen: false,
keepAwake: false,
successCallback: function() {
console.log("Player closed without error.");
},
errorCallback: function(errMsg) {
console.log("Error! " + errMsg);
}
};
window.plugins.streamingMedia.playAudio(audioUrl, options);
window.plugins.streamingMedia.stopAudio();
window.plugins.streamingMedia.pauseAudio();
window.plugins.streamingMedia.resumeAudio();
Special Thanks
Michael Robinson (@faceleg)
Timothy Shamilov (@shamilovtim)