swift - Nothing displayed when trying to run a Vimeo video iOS App -
i trying run vimeo video in app, , method makes sense me method example [ https://stackoverflow.com/a/15918011/4856759 ].
so have attempted recreate method in swift own vimeo link, blank screen.
as far can tell have created relevant string, converted nsstring , loaded using loadhtmlstring method - missing?
@iboutlet weak var webview: uiwebview! override func viewdidload() { super.viewdidload() var embedhtml = "<iframe width=\"300\" height=\"250\" src=\"http://www.vimeo.com/113067409" frameborder=\"0\" allowfullscreen></iframe>" var html: nsstring = nsstring(string: embedhtml) webview.loadhtmlstring(html, baseurl: nil) }
your link valid, way embedding html vimeo not correct , have set base url to "http://"
instead of nil.
here working code:-
@iboutlet weak var webview: uiwebview! override func viewdidload() { super.viewdidload() var embedhtml="<html><head><style type=\"text/css\">body {background-color: transparent;color: white;}</style></head><body style=\"margin:0\"><iframe src=\"//player.vimeo.com/video/113067409?autoplay=1&loop=1\" width=\"1024\" height=\"768\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>"; webview.delegate = self var url: nsurl = nsurl(string: "http://")! webview.loadhtmlstring(embedhtml string, baseurl:url ) }
Comments
Post a Comment