使用 YouTube iFrame 显示 YouTube 视频广告 [英] Displaying YouTube Video ads with YouTube iFrame

查看:30
本文介绍了使用 YouTube iFrame 显示 YouTube 视频广告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一个显示我的 YouTube 视频的 iOS 应用,我是 YouTube 合作伙伴,当我在浏览器中播放视频时会显示视频广告.但是,在使用官方 iOS YouTube 播放器时,它不会显示任何类型的视频广告,有谁知道如何显示视频广告或解决这个问题?

我正在使用的 YouTube 播放器库 并且在 StackOverflow 上对此进行了讨论:YouTube iOS 中的错误"玩家助手库.

最终,iFrame 广告在 PR #58.这得到了 YouTube 开发者关系团队成员 Ibrahim Ulukaya 的认可.

使用 iFrame API 随时会被弃用,我不会YouTube 正在为 iOS 开发一个更好的库,类似于他们为 Android 开发的库,这并不奇怪.但目前,YTPlayerView 中不会出现广告.

I'm currently developing an iOS app that displays my YouTube videos, I am a YouTube partner and video ads show up when I play my videos inside my browser. However while using the official iOS YouTube Player it doesn't show any kind of video ads whatsoever, does anyone know how to display video ads or get this fixed?

The YouTube Player Library I'm using https://github.com/youtube/youtube-ios-player-helper

Here are the parameters I'm using

  NSDictionary *playerVars = @{
                             @"controls" : @1,
                             @"playsinline" : @1,
                             @"autohide" : @0,
                             @"showinfo" : @0,
                             @"autoplay" : @1,
                             @"fs" : @0,
                             @"rel" : @0,
                             @"loop" : @1,
                             @"enablejsapi" : @1,
                             @"modestbranding" : @1
                             };

As you can see in this image it just starts playing the video and doesn't play any video ad before the video starts

解决方案

When the YTPlayerView iFrame loaded an ad, it used to force the user right out of their app and into Safari. I had opened an issue on the library's GitHub project page back in January and there was a discussion about it on StackOverflow here: Bug in 'YouTube iOS Player Helper' library.

Ultimately, iFrame ads were disabled in PR #58. This was sanctioned by Ibrahim Ulukaya, a member of YouTube's developer relations team.

With iFrame API subject to deprecation at any time, I wouldn't be surprised of YouTube was working on a better library for iOS, similar to the one they have for Android. But for now, ads will not show up in the YTPlayerView.

这篇关于使用 YouTube iFrame 显示 YouTube 视频广告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆