The 2017 Ionic Developer Survey Results are in!

Streaming Media

Improve this doc

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

Repo: https://github.com/nchutchind/cordova-plugin-streaming-media

Installation

  1. Install the Cordova and Ionic Native plugins:
    $ ionic cordova plugin add cordova-plugin-streaming-media
    $ npm install --save @ionic-native/streaming-media
    
  2. Add this plugin to your app's module

Supported platforms

Usage

import { StreamingMedia, StreamingVideoOptions } from '@ionic-native/streaming-media';

constructor(private streamingMedia: StreamingMedia) { }

let options: StreamingVideoOptions = {
  successCallback: () => { console.log('Video played') },
  errorCallback: (e) => { console.log('Error streaming') },
  orientation: 'landscape'
};

this.streamingMedia.playVideo('https://path/to/video/stream', options);

Instance Members

playVideo(videoUrl, options)

Streams a video

Param Type Details
videoUrl string

The URL of the video

options StreamingVideoOptions

Options

playAudio(audioUrl, options)

Streams an audio

Param Type Details
audioUrl string

The URL of the audio stream

options StreamingAudioOptions

Options

stopAudio()

Stops streaming audio

pauseAudio()

Platforms:iOS 

Pauses streaming audio

resumeAudio()

Platforms:iOS 

Resumes streaming audio

StreamingVideoOptions

Param Type Details
successCallback Function (optional)
errorCallback Function (optional)
orientation string (optional)

StreamingAudioOptions

Param Type Details
bgColor string (optional)
bgImage string (optional)
bgImageScale string (optional)
initFullscreen boolean (optional)
successCallback Function (optional)
errorCallback Function (optional)

API

Native

General