import DacastPlayerIOS
Next add the following code to your viewDidLoad
function:
let player = DacastPlayer(contentIdStr: "104301_f_506288", adUrl: "https://cdn.theoplayer.com/demos/preroll.xml")
player.frame = CGRect(x: 0, y: 0, width: 400, height: 400)
player.addAsSubview(of: self.view)
Let's break down this code. First we create a DacastPlayer
object with 2 arguments: the contentId and an adUrl.frame
property and add the player to the current view with addAsSubview
(you can also use insertAsSubview
)
player.getTHEOplayer()
and refer to the official THEOplayer documentation.