Plugin: Cross Platform Video Player

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.

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" />
10. 
11.        <!-- Here is a remote file to test with https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4 -->
12. 
13.    </StackLayout>
14.</Page>


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

Credits:

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

Share this article

Comments


Comments are disabled in preview mode.

Stay connected with NativeScript

NativeScript
NativeScript is licensed under the Apache 2.0 license .
© 2016 Progress Software Corporation. All Rights Reserved.