Back to Blog Home
← all posts

Plugin: Cross Platform Video Player

February 8, 2016 — by Dan Wilson

Who loves funny cat videos? Aren’t your users requesting MORE CAT VIDEOS in your NativeScript applications? How do you exactly insert a video player for these cat videos in your NativeScript application?

Well, before today, you could have just called the native video player on iOS or Android with Javascript. That’s the power of NativeScript, right? No bindings or messy code, just straight 100% native API access.

The illustrious and enterprising Brad Martin, wrote a cross platform video player plugin for NativeScript to make it super easy to include a video player in your NativeScript application. Simply declare the player in your view layer, and the appropriate native Video Player will be executed at run time.

01.<Page xmlns=""
02.    xmlns:VideoPlayer="videoplayer">
03.    <StackLayout>
04.        <VideoPlayer:Video
05.        loaded="videoplayerLoaded"
06.        finished="videoFinished"
07.        autoplay="true"
08.        height="300"
09.        src="~/videos/small.mp4" />
11.        <!-- Here is a remote file to test with -->
13.    </StackLayout>

To see how this looks, view the video embedded in Brad's tweet.


If you would like to see your name in lights, currently the team is looking for someone to add the ability to load remote videos in iOS.

Edit: An hour after this blog entry posted, we've been notified the iOS version has been updated by Alex Ziskind to handle remote videos. #BreakneckSpeed #OpenSourceFTW #GoTeam