ios7 UIWebView Youtube 视频

2023-12-25

我有一个 UIWebView 子类,用来播放 youtube 和本地视频。在iOS6下完美运行。在升级到 iOS7 的过程中,我遇到了一个问题,我真的不知道从哪里开始。虽然子类似乎仍然可以在 iOS7 模拟器上播放 youtube 和本地视频,但当我在设备上播放 youtube 时,我会记录以下消息:

Sep 26 10:17:27 JRR-IPad SVOx[558] <Error>: CGContextSaveGState: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.

Sep 26 10:17:27 JRR-IPad SVOx[558] <Error>: CGContextSetBlendMode: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.

Sep 26 10:17:27 JRR-IPad SVOx[558] <Error>: CGContextSetAlpha: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.

Sep 26 10:17:27 JRR-IPad SVOx[558] <Error>: CGContextTranslateCTM: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.

Sep 26 10:17:27 JRR-IPad SVOx[558] <Error>: CGContextScaleCTM: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update. 

Sep 26 10:17:27 JRR-IPad SVOx[558] <Error>: CGContextGetCTM: invalid context 0x0.
This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.

Sep 26 10:17:27 JRR-IPad SVOx[558] <Error>: CGContextDrawImage: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.

Sep 26 10:17:27 JRR-IPad SVOx[558] <Error>: CGContextGetCTM: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.

===

这种情况只发生在设备上,模拟器上没有,在iOS6下也没有发生。我在这里看到过一些帖子谈论测试版中各种类的类似问题,但我还没有看到有关iOS7发布版本的评论。

我在代码中没有使用任何这些方法,因此这些消息源自库内。

任何人? TIA。


使用它,您可以在您的视图中运行 YouTube 视频。

UIWebView *videoView = [[UIWebView alloc] initWithFrame:self.view.bounds];

    NSString *strparse = [NSString stringWithFormat:@"http://www.youtube.com/watch?v=%@",youtubeVideoId];
    NSRange rng = [strparse rangeOfString: @"watch?v="];
    strparse = [strparse substringFromIndex:rng.location];
    rng = [strparse rangeOfString:@"&feature="];


    if (rng.length >0)
    {
        strparse = [strparse substringToIndex:rng.location];
    }
    strparse = [strparse stringByReplacingOccurrencesOfString:@"watch?v=" withString:@""];
    //http://www.youtube.com/embed/FJkiwbqlSy0
    NSString *youTubeVideoHTML =[NSString stringWithFormat:@"<!DOCTYPE html><html><head><style>body{margin:0px 0px 0px 0px; background:#1111}</style></head> <body> <div id=\"player\"></div> <script> var tag = document.createElement('script'); tag.src = \"http://www.youtube.com/player_api\"; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); var player; function onYouTubePlayerAPIReady() { player = new YT.Player('player', { width:'%0.0f', height:'%0.0f', videoId:'%@', events: { 'onReady': onPlayerReady, 'onStateChange': onPlayerStateChange } });} function onPlayerReady(event) { event.target.playVideo(); } function onPlayerStateChange(event) {if(event.data === 0) {   event.target.destroy(); }}  </script> </body> </html>",0.0, 0.0,youtubeVideoId];


    videoView.scalesPageToFit=NO;
    videoView.mediaPlaybackRequiresUserAction=NO;
    videoView.backgroundColor = [UIColor clearColor];
    videoView.opaque= NO;


    [SharedObj showLoadingWithText:@""];

    [videoView loadHTMLString:youTubeVideoHTML baseURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://www.youtube.com/watch?v=%@",youtubeVideoId]]];


    [self.view addSubview:videoView];
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

ios7 UIWebView Youtube 视频 的相关文章

随机推荐

  • C# 将字符串复制到字节缓冲区

    我正在尝试将 Ascii 字符串复制到字节数组 但无法 如何 这是我迄今为止尝试过的两件事 两者都不起作用 public int GetString ref byte buffer int buflen string mystring he
  • Objective-C 中的遮罩视图

    In 动作脚本3我们可以将蒙版应用到视觉对象 如下所示 SomeVisualObject mask maskShapeObject 我怎样才能达到类似的结果Objective C 假设我有两个UIImageView对象 我想要这样的东西 i
  • POD全局对象初始化

    我今天被虫子咬了 问 C 律师的问题 让我们考虑以下来源 struct MyPod short m short const char const m string MyPod myArrayOfPod 1 Hello int main in
  • RxJava - 将列表的结果映射到另一个列表

    我想将列表中的每个对象转换为另一个对象 但这样做时我的代码坚持将它们转换回列表 override fun myFunction LiveData
  • 为什么我无法在 Mac OSX Lion 上安装 Ruby 1.9.2? [关闭]

    Closed 这个问题是无关 help closed questions 目前不接受答案 我尝试在装有 OSX Lion 10 7 2 的全新 MacBook Air 上安装 Ruby 1 9 2 但在安装过程中不断收到错误消息 我是 Ru
  • 是否有可以将 PNG 文件转换为 PDF 的 .NET 库?

    我有一个应用程序 需要将 PNG 文件即时转换为 PDF 现有的图书馆可以做到这一点吗 我希望 PDF 看起来与 PNG 完全一样 没有多余的边距 没有边框等 我正在使用 NET 4 0 编辑 我尝试了 iTextSharp 效果很好 这是
  • Sharepoint PeopleEditor:如何找出返回的用户/组类型?

    我有一个人物编辑器
  • 如何将键值元组数组转换为对象

    我有一个数组 cardType iDEBIT txnAmount 17 64 txnId 20181 txnType Purchase txnDate 2015 08 13 21 50 04 respCode 0 isoCode 0 aut
  • 在 Asp.net Identity MVC 5 中创建角色

    关于使用新的 Asp net 身份安全框架的文档非常少 我已经拼凑了我可以尝试创建一个新角色并向其中添加一个用户的内容 我尝试了以下方法 在 ASP NET Identity 中添加角色 https stackoverflow com qu
  • 使用 new Image() 时 JavaScript 中的内存泄漏

    我似乎有内存泄漏 是由于在 javascript 脚本中使用 new Image 引起的 如果我在 Windows 资源监视器中查看已使用的物理内存 我会在加载页面时获得预期的内存使用量增加 因为它使用以下方式加载一些相当大的图像 var
  • htaccess 重写 URL 不适用于 codeigniter 代码

    我正在尝试重写 URLS 以便 foo gt index php index php 由 codeigniter 3 提供支持 bar php 是一个独立的 php 文件 这是我的 htaccess 中的片段 Test 1 Bar php
  • 如何完美同步两个或多个html5视频标签?

    有没有办法让两个或更多 最好是三个 html5标签同时播放并完美同步 如果我有一个视频的三个图块 我希望它们作为一个大视频出现在浏览器中 他们需要成为完美同步 甚至没有最小的视觉 垂直提示表明它们是平铺的 不幸的是我无法使用 MediaCo
  • 有没有办法检查 NumPy 数组是否共享相同的数据?

    我的印象是 在 NumPy 中 两个数组可以共享相同的内存 举个例子 import numpy as np a np arange 27 b a reshape 3 3 3 a 0 5000 print b 0 0 0 5000 Some
  • 运行 Quartz.NET 嵌入式或作为 Windows 服务的优缺点

    我想将quartz调度添加到ASP NET应用程序中 它将用于发送排队的电子邮件 将quartz net 作为 Windows 服务运行与嵌入式相比有何优缺点 我主要关心的是嵌入模式下的 Quartz NET 如何处理 IIS 中可变数量的
  • VSCode - 保存时禁用所有自动格式化

    我正在编辑别人的代码 我只想更改 9000 行文件中的 1 行 但每次保存时 VS Code 都会格式化整个文件并删除所有尾随空格 这是一个禁忌 因为当我把它推上去时 审阅者将不知道该看哪一行 我尝试禁用 prettier 将所有文件添加到
  • iPhone + Drupal + JSON RPC 服务器问题

    我不知道如何使用 Obj C 发布 JSON RPC 请求 谁能帮我 到目前为止我有 responseData NSMutableData data retain NSMutableURLRequest request NSMutableU
  • 使用 getNodeSet 解析 XML - 识别缺失的标签

    我正在解析 XML 文件getNodeSet 假设我有一个来自书店的 XML 文件 其中列出了 4 本书 但其中一本书缺少 作者 标签 如果我使用以下方法解析 XML 中的标签 authors data nodes 2 lt getNode
  • android edittext的最小值和最大值

    我正在开发一个android应用程序 实际上我需要为编辑文本条目设置最小值和最大值我的最小值是18 最大值是65 我做了这个的确切代码 package com test import android text InputFilter imp
  • CSS 按钮在 Google Chrome 中不起作用?

    我正在为一家电影公司的网站制作一个主页 它有一个带有悬停效果的 CSS 按钮 一旦准备好就会打开一个灯箱 目前我只是将其设置为 href 作为一个占位符 直到我准备好实现灯箱 还有一个向下箭头的小图像 链接设置为尚未出现在页面上的锚点 这两
  • ios7 UIWebView Youtube 视频

    我有一个 UIWebView 子类 用来播放 youtube 和本地视频 在iOS6下完美运行 在升级到 iOS7 的过程中 我遇到了一个问题 我真的不知道从哪里开始 虽然子类似乎仍然可以在 iOS7 模拟器上播放 youtube 和本地视