Skip to content

mamane10/capacitor-video-player

Β 
Β 

Repository files navigation


Video Player

capacitor-video-player


CAPACITOR 3


Capacitor Video Player Plugin is a custom Native Capacitor plugin to play a video
fullscreen on IOS, Android, Web and Electron platforms
embedded on Web and Electron platforms


Maintainers

Maintainer GitHub Social
QuΓ©au Jean Pierre jepiqueau

LATEST FOR CAPACITOR 3 (Master)

The master release has been upgraded to @capacitor/[email protected].

PREVIOUS CAPACITOR 2.4.7

The 2.4.7 is now πŸ›‘ NOT MAINTAINED ANYMORE πŸ›‘ and can be used as is.

Browser Support

The plugin follows the guidelines from the Capacitor Team,

meaning that it will not work in IE11 without additional JavaScript transformations, e.g. with Babel.

Installation

Release 2.4.7

npm install --save [email protected]
npx cap sync
npx cap sync @capacitor-community/electron
  • On Web and Electron, no further steps are needed.

  • on iOS, you need to set your app Capabilities Background Modes (Audio and AirPlay) in Xcode

  • On Android, register the plugin in your main activity:

import com.jeep.plugin.capacitor.CapacitorVideoPlayer;

public class MainActivity extends BridgeActivity {

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Initializes the Bridge
    this.init(
        savedInstanceState,
        new ArrayList<Class<? extends Plugin>>() {
          {
            // Additional plugins you've installed go here
            // Ex: add(TotallyAwesomePlugin.class);
            add(CapacitorVideoPlayer.class);
          }
        }
      );
  }
}

Release 3.0.0

npm install --save capacitor-video-player@next
npx cap sync
npx cap sync @capacitor-community/electron
  • On Web and Electron ,
npm install --save hls.js
  • on iOS, you need to set your app Capabilities Background Modes (Audio and AirPlay) in Xcode

  • On Android, the AndroidManifest.xmlshould include

  <!-- Permissions -->

  <uses-permission android:name="android.permission.INTERNET" />
  <!-- Camera, Photos, input file -->
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

Build

Then build YOUR_APPLICATION

npm run build
npx cap copy
npx cap copy web
npx cap copy @capacitor-community/electron
npx cap open android
npx cap open ios
npx cap open @capacitor-community/electron
npx cap serve

Configuration

No configuration required for this plugin

Supported methods

Name Android iOS Electron Web
initPlayer (mode fullscreen) βœ… βœ… βœ… βœ…
initPlayer (mode embedded) ❌ ❌ βœ… βœ…
initPlayer (url assets) βœ… βœ… βœ… βœ…
initPlayer (url internal) βœ… βœ… ❌ ❌
initPlayer (url application/files) βœ… βœ… ❌ ❌
initPlayer (subtitles) βœ… βœ… ❌ ❌
isPlaying βœ… βœ… βœ… βœ…
play βœ… βœ… βœ… βœ…
pause βœ… βœ… βœ… βœ…
getCurrentTime βœ… βœ… βœ… βœ…
setCurrentTime βœ… βœ… βœ… βœ…
getDuration βœ… βœ… βœ… βœ…
getMuted βœ… βœ… βœ… βœ…
setMuted βœ… βœ… βœ… βœ…
getVolume βœ… βœ… βœ… βœ…
setVolume βœ… βœ… βœ… βœ…
stopAllPlayers βœ… βœ… βœ… βœ…

Supported listeners

Name Android iOS Electron Web
jeepCapVideoPlayerReady βœ… βœ… βœ… βœ…
jeepCapVideoPlayerPlay βœ… βœ… βœ… βœ…
jeepCapVideoPlayerPause βœ… βœ… βœ… βœ…
jeepCapVideoPlayerEnded βœ… βœ… βœ… βœ…
jeepCapVideoPlayerExit βœ… βœ… βœ… βœ…

Documentation

API_Documentation

Applications demonstrating the use of the plugin

Application Starter 2.4.7

Application Starter 3.0.0 🚧

Usage 2.4.7

Usage 3.0.0 🚧

Dependencies

  • hls.js for HLS videos on Web and Electron platforms
  • ExoPlayer for HLS, DASH, SmoothStreaming videos on Android platform

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Jean Pierre QuΓ©au

πŸ’»

This project follows the all-contributors specification. Contributions of any kind welcome!

About

Capacitor Video Player Plugin

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 44.1%
  • Swift 34.3%
  • TypeScript 20.0%
  • Other 1.6%