Sharing YouTube videos

I was looking for way to share a YouTube video with an Ionic app. And of course, Capacitor came to the rescue!


Capacitor is an open source native runtime for building Web Native apps. It has a lot of official and community plugins, and is available for iOS, Android, and Windows.


The idea is when you select Share, you pick 'Share to clipboard', and if you return to the app, the url will be pasted and eventually you will be redirected to the correct page.

For sharing Youtube videos I'm using the following Capacitor plugins : App & Clipboard


The App API handles high level App state and events. For example, this API emits events when the app enters and leaves the foreground, handles deeplinks, opens other apps, and manages persisted plugin state.

addListener(‘appStateChange’, …)

Listen for changes in the App’s active state (whether the app is in the foreground or background)



Read a value from the clipboard (the “paste” action)


An example of the code looks like this :

For more information on this demo, please visit the Share Demo repository.