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
Installation
cordova plugin add https://github.com/nchutchind/cordova-plugin-streaming-media
iOS specifics
- Uses the AVPlayerViewController, supported for iOS 9+.
- Tested on iOS 11
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();