Before using any AVKIt API, make sure you followed the instructions in Getting Started article.
The ISN_AVPlayerViewController is an object that displays the video content from a player object along with system-supplied playback controls.
The following code snippet shows how you can play video using the web URL:
using SA.IOSNative.Foundation; using SA.IOSNative.AVFoundation; using SA.IOSNative.AVKit; ... var url = ISN_NSURL.URLWithString("https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"); var player = new ISN_AVPlayer(url); var viewController = new ISN_AVPlayerViewController(); viewController.Player = player; //Optional setting that you can apply player.Volume = 0.8f; viewController.ShowsPlaybackControls = true; viewController.AllowsPictureInPicturePlayback = false; viewController.ShoudCloseWhenFinished= false; viewController.Show();
If you want to store some videos locally and it inside your application build. You can put it inside Unity StreamingAssets assets folder.
The example below demonstrates how you may play video from the root of your StreamingAssets folder:
var url = ISN_NSURL.StreamingAssetsURLWithPath("big_buck_bunny.mp4"); var player = new ISN_AVPlayer(url); player.Volume = 0; var viewController = new ISN_AVPlayerViewController(); viewController.Player = player; viewController.Show();