Code Monkey home page Code Monkey logo

streaming-media-cordova-plugin's Introduction

#Status of Plugin: Unmaintained I developed this plugin while working on a project that needed streaming media. A year ago, I left that job and have not had a need (or the time) to revisit this plugin, which is why there have been no updates. I would love to see someone fork this repo and build it up into something that the community can continue to use, but I just do not have the ability to do that myself now.

Cordova Streaming Media plugin

for iOS and Android, by Nicholas Hutchind

  1. Description
  2. Usage

1. Description

This plugin allows you to stream audio and video in a fullscreen, native player on iOS and Android.

  • Works with PhoneGap >= 3.0.

iOS specifics

  • Uses the MPMoviePlayerController.
  • Tested on iOS 7. (If someone has an iOS 6 device, please report back to me how it does.)

Android specifics

  • Uses VideoView and MediaPlayer.
  • Creates two activities in your AndroidManifest.xml file.
  • Tested on Android 4.0+. (If someone has a Gingerbread device, please report back to me how it does.)

2. Usage

  var videoUrl = STREAMING_VIDEO_URL;

  // Just play a video
  window.plugins.streamingMedia.playVideo(videoUrl);
  
  // Play a video with callbacks
  var options = {
    successCallback: function() {
      console.log("Video was closed without error.");
    },
    errorCallback: function(errMsg) {
      console.log("Error! " + errMsg);
    }
  };
  window.plugins.streamingMedia.playVideo(videoUrl, options);


  var audioUrl = STREAMING_AUDIO_URL;
  
  // Play an audio file (not recommended, since the screen will be plain black)
  window.plugins.streamingMedia.playAudio(audioUrl);

  // Play an audio file with options (all options optional)
  var options = {
    bgColor: "#FFFFFF",
    bgImage: "<SWEET_BACKGROUND_IMAGE>",
    bgImageScale: "fit",
    initFullscreen: false, // true(default)/false iOS only
    successCallback: function() {
      console.log("Player closed without error.");
    },
    errorCallback: function(errMsg) {
      console.log("Error! " + errMsg);
    }
  };
  window.plugins.streamingMedia.playAudio(audioUrl, options);


  // Stop current audio
  window.plugins.streamingMedia.stopAudio();

streaming-media-cordova-plugin's People

Contributors

nchutchind avatar steffenmllr avatar

Watchers

Anton Ashardi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.