خرید بک لینک

Vote count: 0

I'm having an issue trying to autoplay my UIWebView.

Yes, I know there are tons of questions regarding it already.

Fist off, here's my simple code:

override func viewDidLoad()
{
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.

    let youtubePlayer:UIWebView = UIWebView(frame: CGRectMake(0, 0, UIScreen.mainScreen().bounds.width, UIScreen.mainScreen().bounds.height))

    youtubePlayer.loadRequest(NSURLRequest(URL: NSURL(string: "https://www.youtube.com/embed/EzNinU0g-Q0")!) )

    self.view.addSubview(youtubePlayer)
}

Now here's what I found:

  1. How to autoplay a YouTube video in a UIWebView
  2. Youtube video autoplay inside UIWebview
  3. How to get YouTube autoplay to work in UIWebView?

I did as suggested with the following codes:

youtubePlayer.mediaPlaybackRequiresUserAction = false
youtubePlayer.allowsInlineMediaPlayback = true

That did nothing.

  1. autoplay on video in UIWebview,iOS

This solution works, however, it's not for embedded videos, which is what I'm using.

Therefore, is there no way to auto-play using the UIWebView?

Can anyone suggest an alteative? Since I have a UITableView set up to where, when the user selects a cell (video), it will show the UIWebView of the video.

However, I would like, if possible for the video to start playing immediately when the user selects a video instead of having to press play again to play it.

Thanks.

asked 2 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: شنبه 1 اسفند 1394 ساعت: 4:02

صفحه بندی