1) Get Started

The TVPage iOS SDK offers a custom player, API calls, functions, events, and Analytics which integrate into the iOS application.

The developer needs to drag and drop the SDK into their application and they can use the provided facility.

Calls to API will return the Video list and information of the videos. SDK provides the Events and functions.

2) Prerequisites

  • Xcode 8.0 or higher.
  • An iOS 9.0 or higher deployment target.
  • A valid iOS project.

3) Download SDK

    Download SDK from below URL.

iOS SDK: The SDK is currently being updated. The new version will be released in Q2 2019. This section will be populated with an updated URL once complete.

4) Drag and Drop the SDK into your iOS application as below.

Drop two framework 1) TVP.framework and 2) TVPBundle.bundle.

You will get the API Documentation from http://help.tvpage.com/developers 

5) Refer TVPage Player demo from below URL

iOS SDK Example Application: https://github.com/tvpage/sdk-ios-example-app        

6) How to use Framework into classes

Import the TVP Framework into your class:

import TVP

Extend the delegate method to the ViewController class using:

TVPlayerDelegate

Create one variable for TVPagePlayerView to play video

Create one IBOutlet variable

@IBOutlet var viewTVP: UIView!

var TVPView:TVPagePlayerView!

TVPView = TVPagePlayerView.init(frame: CGRect(x: 50, y: 200, width: 350, height: 200))

        self.viewTVP.addSubview(TVPView)

        TVPView.show(frame: CGRect(x:0,y:0,width:viewTVP.frame.size.width,height:viewTVP.frame.size.height), view: self.viewTVP)      

7) List of API functions available in Framework as below

In order to access the API from Framework you just need to import TVP framework into the respective class.

Here we assume that Login Id is 123456, we will declare Login id as.

var loginID = "123456"         

Get Channel Video List using below function

TvpApiClass.ChannelVideoList(strLoginID: loginID, strChhanelID:"654123", searchString: "") { (arrChannelVideolist:NSArray,strerror:String) in

}

Get Video List from API using below function

TvpApiClass.VideoList(loginID: loginID, pageNumber: "", Max: "", orderBy: "", Order_direction: "", searchString: "", status: "") { (arrVideoList:NSArray, errorString:String) in

           

        }

Get Video Details from API using below function

TvpApiClass.GetVideoDetails(LoginID: loginID, VideoID: "") { (arrVideoList:NSArray, errorString:String) in

           

        }

Get Video id to Channels from API using below function

TvpApiClass.GetVideoIdToChannels(LoginID: loginID, VideoID: "78945615") { (arrVideoList:NSArray, errorString:String) in

           

        }

Get Products on Video from API using below function

TvpApiClass.GetproductsOnVideo(LoginID: loginID, VideoID: "78945615"){  (arrVideoList:NSArray, errorString:String) in

           

        }

Get Transcript on Video from API using below function

TvpApiClass.GettranscriptOnVideo(LoginID: loginID, VideoID: "78945615") {  (arrVideoList:NSArray, errorString:String) in

           

        }

Get one or more videos that match a list of SKUs using below function

TvpApiClass.Get_match_a_list_of_SKU_(LoginID: loginID, referenceIds: "1234567"){  (arrVideoList:NSArray, errorString:String) in

           

        }

Get Video Search Results using below function

TvpApiClass.Get_Searches_video_list(loginID: loginID, Searchstring: "search video", Pagenumber: "1", Max: "", orderBy: "", Order_direction: "", channelsLimitIds: "") {  (arrVideoList:NSArray, errorString:String) in

           

        }

Retrieves a list of channels using below function

TvpApiClass.ProductsList(loginID: loginID, pageNumber: "", Max: "", orderBy: "", Order_direction: "", searchString: "") {  (arrVideoList:NSArray, errorString:String) in

           

        }

Retrieves details of a specific product

TvpApiClass.Get_detail_Of_Product(LoginID: loginID, productsId: "1234") {  (arrVideoList:NSArray, errorString:String) in

           

        }

Retrieves a list of product video recommendations

TvpApiClass.Get_list_Of_Product_recommendations(LoginID: loginID, productsId: "1234", pageNumber: "", Max: "") 

{  (arrVideoList:NSArray, errorString:String) in

           

      }

Retrieves a list of videos associated with a specific product

TvpApiClass.Get_listOfVideo_SpecificProduct(LoginID: loginID, productsId: "1234") {  (arrVideoList:NSArray, errorString:String) in

           

      }

Retrieves a list of channels

TvpApiClass.ChannelList(loginID: loginId, pageNumber: "", Max: "", orderBy: "", Order_direction: "", searchString: "")

{  (arrVideoList:NSArray, errorString:String) in

           

      }

Retrieves details of a specific channel

TvpApiClass.GetChannelsDetails(strLoginID: loginID, strChhanelID: "") {  (arrVideoList:NSArray, errorString:String) in

           

      }

8) List of Delegate methods

First, we need to extend the TVplayerDelegate to the class then we can access the delegate method.

Player Ready

func TvPlayerReady(flag: Bool) {

        print("Delegate TvPlayerReady :\(flag)")

       }

Error Event

func TvPlayerError(flag: Error) {

        print("Delegate TvPlayerError :\(flag)")

    }

Media Ready

func TvPlayerMediaReady(flag: Bool) {

        print("Delegate TvPlayerMediaReady :\(flag)")

    }

Media Error

func TvPlayerMediaError(flag: Error) {

        print("Delegate TvPlayerMediaError :\(flag)")

    }

Media Error Forbidden

func TvPlayerErrorForbidden(flag: Error) {

        print("Delegate TvPlayerMediaErrorForbidden:\(flag)")

    }

Media Error HTML5 Forbidden

func TvPlayerErrorHTML5Forbidden(flag: Error) {

        print("Delegate TvPlayerErrorHTML5Forbidden:\(flag)")

}

Media Complete

func TvPlayerMediaComplete(flag: Bool) {

        print("Delegate TvPlayerMediaComplete :\(flag)")

    }

Media Cued

func TvPlayerCued(flag: Bool) {

        print("Delegate TvPlayerCued :\(flag)")

}

Video Ended

func TvPlayerMediaVideoended(flag: Bool) {

        print("Delegate TvPlayerMediaVideoended :\(flag)")

    }

Video Playing

func TvPlayerMediaVideoplaying(flag: Bool) {

        print("Delegate Playing:\(flag)")

    }

Video Paused

func TvPlayerMediaVideopaused(flag: Bool) {

        print("Delegate Paused:\(flag)")

    }

Video Buffering

func TvPlayerMediaVideobuffering(flag: Bool) {

        print("delegate_TvPlayerMediaVideobuffering:\(flag)")

    }

Playback Quality Change

func TvPlayerPlaybackQualityChange(flag: String) {

print("Delegate TvPlayerPlaybackQualityChange:\(flag)")

    }

Media Provider Change

func TvPlayerMediaProviderChange(flag: String) {

            print("delegate_TvPlayerMediaProviderChange:\(flag)")

    }

TVPlayer Seek

func TvPlayerSeek(flag: String) {

            print("Delegate TvPlayerSeek:\(flag)")

    }

TVPlayer Video Load

func TvPlayerVideoLoad(flag: Bool) {

            print("Delegate TvPlayerVideoLoad:\(flag)")

    }

TVPlayer Video Cued

func TvPlayerVideoCued(flag: Bool) {

        print("Delegate TvPlayerVideoCued:\(flag)")

    }

9) List of Functions for TVPage Player

First, you have to create one object using “TvPagePlayerView” class.

Using object we can access the player methods.

Create one object as like below e.g.:

var TVPView:TVPagePlayerView!

TVPView = TVPagePlayerView.init(frame: CGRect(x: 50, y: 200, width: 350, height: 200))

        self.view.addSubview(TVPView)

Load a Video

TVPView.loadVideo(StrURL: "String URL", strType: "Youtube/Vimeo")

Queue a Video

TVPView.cueVideo(StrURL: "String URL", strType: "Youtube/Vimeo")

Play a Video

TVPView.play()

Pause a Video

TVPView.pause()

Stop a Video

TVPView.stop()

Set a video Volume

TVPView.volume(vol: 0.5)

Set a Mute

TVPView.mute()

Set an UnMute

TVPView.unmute()

Check isMuted

var mutedOrNot:Bool = TVPView.isMuted

Set Seek time for video in seconds

TVPView.seek(time: 15)

Set player background poster

TVPView.setPoster(image: UIImage.init(named: "Image Name")!)

Resize to width and height in pixel and zoom ratio from

TVPView.resize(width: 320.0, height: 300.0, X: 10.0, Y: 10.0, zoomRatio: 0.8)

Get Volume from TVPlayer

var volume:Int = TVPView.getVolume()

Get State from Player

var playerState:Int = TVPView.getState()

Get current time in second from Player

var currentTimeInSecond:Int = TVPView.getCurrentTime()

Get duration in Seconds

var currentDurationInSecond:Double = TVPView.getDuration()

Get Quality from Player

var qualityFromPlayer:Int = TVPView.getQuality()

Set available Quality in Player

TVPView.setQuality(index: 1)

Get available video quality levels

var levelsOfQualityArray:NSMutableArray = TVPView.getQualityLevels()

Get height of Player

var heightOfPlayer:Float = TVPView.getHeight()

Get width of Player

var widthOfPlayer:Float = TVPView.getWidth()

Disable the controls of video Player

TVPView.disableControls()

Enable the controls of video Player

TVPView.enableControls()

Hide the controls of video Player

TVPView.hideControls()

Show the controls of video Player

TVPView.showControls()

10) Analytics available in your TVPage Player Framework

The TVPage Analytics SDK records and sends analytics events to the TVPage backend to be further processed and presented on TVPage’s Analytics Dashboard.

There is some analytics function which will call automatically when player loads, video views, and some methods are on a period of time.

  1. Channel Impression API call when player loads.
  2. Video View will call after 3 seconds of video play.
  3. View Time API will call every after 3 seconds of video play.
  4. Product Impression API will call when Product will display under the video player.

We can access the Analytics API using object of TVPagePlayer Class

TVPView.Analytics_Product_Impression(LoginID: "123456789", ChannelID: "654123", VideoID: "987456", ProductID: "456258") { (resultString: String) in

           

        }

Product Click API will call when product is clicked by user showing under the video player.

TVPView.Analytics_Product_Click(LoginID: "123456789", ChannelID: "654123", VideoID: "987456", ProductID: "456258") { (resultString: String) in

           

        }
Did this answer your question?