小编Mor*_*ang的帖子

从AVPlayer获取HLS的PCM数据

过去几年似乎几次都没问过这个问题,但没有人回答这个问题.我正在尝试从HLS处理PCM数据,我必须使用AVPlayer.

这篇文章点击本地文件 https://chritto.wordpress.com/2013/01/07/processing-avplayers-audio-with-mtaudioprocessingtap/

这个点击工作与远程文件,但不与.m3u8 hls文件. http://venodesigns.net/2014/01/08/recording-live-audio-streams-on-ios/

我可以在播放列表中播放前两个曲目,但它不会启动所需的回调来获取pcm,当文件是本地或远程(不是流)我仍然可以得到pcm但是它是hls不工作而我需要HLS工作

这是我的代码

//avplayer tap try
- (void)viewDidLoad {
    [super viewDidLoad];

    NSURL*testUrl= [NSURL URLWithString:@"http://playlists.ihrhls.com/c5/1469/playlist.m3u8"];

    AVPlayerItem *item = [AVPlayerItem playerItemWithURL:testUrl];
    self.player = [AVPlayer playerWithPlayerItem:item];

    // Watch the status property - when this is good to go, we can access the
    // underlying AVAssetTrack we need.
    [item addObserver:self forKeyPath:@"status" options:0 context:nil];

}

-(void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary *)change
context:(void *)context
{
    if(![keyPath isEqualToString:@"status"])
        return;

    AVPlayerItem *item = (AVPlayerItem *)object;
    if(item.status != AVPlayerItemStatusReadyToPlay)
        return;

    NSArray *tracks = [self.player.currentItem tracks]; …
Run Code Online (Sandbox Code Playgroud)

audio pcm http-live-streaming ios avplayer

33
推荐指数
1
解决办法
1521
查看次数

如何用AVPlayer解析m3u文件

我想从m3u文件头获取跟踪信息而不是id3Tags.在AVPlayer的timedMetaData属性中,它仅提供id3Tag解析.

如何从AVPlayer跟随m3u文件获取标题,艺术家,网址等

#EXTM3U
#EXT-X-ALLOW-CACHE:NO
#EXT-X-TARGETDURATION:11
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:10,title="Dark Horse",artist="Katy Perry / Juicy J",url="song_spot=\"M\" MediaBaseId=\"1971116\" itunesTrackId=\"0\" amgTrackId=\"-1\" amgArtistId=\"0\" TAID=\"35141\" TPID=\"23894643\" cartcutId=\"0729388001\" amgArtworkURL=\"http://assets.iheart.com/images/1080/MI0003667474\" length=\"00:03:32\" unsID=\"-1\""
http://chunks.ihrhls.com/1469/GqsS8fnz2S6-301028-9984.aac
#EXTINF:10,title="Dark Horse",artist="Katy Perry / Juicy J",url="song_spot=\"M\" MediaBaseId=\"1971116\" itunesTrackId=\"0\" amgTrackId=\"-1\" amgArtistId=\"0\" TAID=\"35141\" TPID=\"23894643\" cartcutId=\"0729388001\" amgArtworkURL=\"http://assets.iheart.com/images/1080/MI0003667474\" length=\"00:03:32\" unsID=\"-1\""
http://chunks.ihrhls.com/1469/spXO68wER45-301029-9984.aac
#EXTINF:10,title="Dark Horse",artist="Katy Perry / Juicy J",url="song_spot=\"M\" MediaBaseId=\"1971116\" itunesTrackId=\"0\" amgTrackId=\"-1\" amgArtistId=\"0\" TAID=\"35141\" TPID=\"23894643\" cartcutId=\"0729388001\" amgArtworkURL=\"http://assets.iheart.com/images/1080/MI0003667474\" length=\"00:03:32\" unsID=\"-1\""
http://chunks.ihrhls.com/1469/RSEeNpIOEHk-301029-10031.aac
Run Code Online (Sandbox Code Playgroud)

parsing objective-c http-live-streaming ios avplayer

9
推荐指数
1
解决办法
1746
查看次数

如何在警报视图IOS中创建两个文本字段

我想创建一个包含两个uitextfields的alertview.

method:
//show alertview for file input
- (IBAction)showAddFiles:(id)sender {
    UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Enter File Details"
                                                      message:nil
                                                     delegate:self
                                            cancelButtonTitle:@"Cancel"
                                            otherButtonTitles:@"Add", nil];



    UITextField *textFieldDescription = [message textFieldAtIndex:0];
    textFieldDescription.placeholder = @"File Description : Ex. Acat Briefing";
    UITextField *textFieldFileName = [message textFieldAtIndex:1];
    textFieldFileName.placeholder = @"Exact File Name : Ex. acat.pdf";


    [message show];
}


//make sure file description is long enoguh
- (BOOL)alertViewShouldEnableFirstOtherButton:(UIAlertView *)alertView
{
    NSString *inputText = [[alertView textFieldAtIndex:0] text];

    if( [inputText length] <= 15 && [inputText length] >= 4)
    { …
Run Code Online (Sandbox Code Playgroud)

uitextfield uialertview ios

6
推荐指数
1
解决办法
9490
查看次数

TabBarController返回null

我在故事板中有一个tabbarcontroller作为初始视图控制器

在此输入图像描述

在此输入图像描述

这是如何返回null的

UITabBarController* tabbarController = (UITabBarController*) self.tabBarController;
NSLog(@"%@",tabbarController);
NSLog(@"%@",self.navigationController.tabBarController);
Run Code Online (Sandbox Code Playgroud)

本来就是我想要做的

NSMutableArray *newTabs = [NSMutableArray arrayWithArray:[self.tabBarController viewControllers]];
NSLog(@"\n\n\n%lu\n\n\n",(unsigned long)[newTabs count]);
NSLog(@"self.tabBarController.viewControllers %@ \n\n",self.tabBarController);
[newTabs removeObjectAtIndex: 1];
[self.tabBarController setViewControllers:newTabs];
Run Code Online (Sandbox Code Playgroud)

为什么我会变空?

null objective-c uitabbarcontroller ios

6
推荐指数
1
解决办法
2353
查看次数

如何在UIWebView IOS上显示html内容

我有一个表单segue应该显示硬编码的html页面.现在我有两个问题,第一个问题是

 <CENTER><H1>A Simple Sample Web Page</H1><H4>By Frodo</H4>
<H2>Demonstrating a few HTML features</H2></CENTER>
Run Code Online (Sandbox Code Playgroud)

显示为

在此输入图像描述

我可以更改<CENTER>标签,<left>在这种情况下它可以工作,但它限制了我的选择.如何显示此内容在屏幕中间没有对齐问题?

问题的第二部分是如何嵌入内容的颜色或链接.在线 ""FFFFFF">\n"我得到的错误说明Expected ':'并在线"<a href="http://somegreatsite.com">\n"半线是绿色,这似乎是屏幕上的评论,这意味着它不会被XCode执行

我的完整代码如下:

- (void) createWebViewWithHTML{
    //create the string
    NSMutableString *html = [NSMutableString stringWithString: @"<html><head><title></title></head><body style=\"background:transparent;\">"];

    //continue building the string
    [html appendString:@"<BODY BGCOLOR="
     ""FFFFFF">\n"
     "<CENTER><IMG SRC="clouds.jpg" ALIGN="BOTTOM">
     "</CENTER> \n"
     "<HR>\n"
     "<a href="http://somegreatsite.com">\n"
     "Link Name</a>\n"

     "is a link to another nifty site\n"

     "<H1>This is a Header</H1>\n"

     "<H2>This is a Medium Header</H2>\n"

     "Send me mail at <a …
Run Code Online (Sandbox Code Playgroud)

html objective-c uiwebview nsmutablestring ios

5
推荐指数
1
解决办法
2万
查看次数

如何获取文件Amazon S3,AWS IOS SDK的上传日期

我有一个包含文件的S3存储桶.我可以在我的应用程序上成功下载并显示该文件.

但是我想知道如果文件是最新的或没有.使用Firefox S3扩展,我可以看到在存储桶文件名中,文件大小和上传时间都保存到S3.上传时间的一个例子是10/10/2012 11:35 PM

得到我使用的网址

dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
    dispatch_async(queue, ^{

        // Set the content type so that the browser will treat the URL as an image.
        S3ResponseHeaderOverrides *override = [[S3ResponseHeaderOverrides alloc] init];
        override.contentType = @" ";

        // Request a pre-signed URL to picture that has been uplaoded.
        S3GetPreSignedURLRequest *gpsur = [[S3GetPreSignedURLRequest alloc] init];
        gpsur.key                     = _fileName;
        gpsur.bucket                  = [Constants pictureBucket];
        gpsur.expires                 = [NSDate dateWithTimeIntervalSinceNow:(NSTimeInterval) 3600]; // Added an hour's worth of seconds to the current time. …
Run Code Online (Sandbox Code Playgroud)

date objective-c amazon-s3 amazon-web-services ios

4
推荐指数
1
解决办法
3582
查看次数

Asp.net 标签不更新

我想在代码隐藏的事件中更新标签的文本。

在母版页标签中声明如下:

<asp:Content ID="WorklistBody" ContentPlaceHolderID="BodyHolder" runat="server">


    <asp:Label id ="lblOutput" runat="server" class="textStyle4" ForeColor="Red"></asp:Label>
    <asp:CustomValidator ID="CustomValidator1" ValidationGroup="SM" runat="server" ErrorMessage="CustomValidator" class="textStyle4" OnServerValidate="CustomValidatorServerValidate">
        </asp:CustomValidator>

// tables and other items goes on here......
Run Code Online (Sandbox Code Playgroud)

我之前的开发人员使用类似以下内容来更新标签;

<script language="javascript" type="text/javascript">
        function ValidateComments() {
            var selOption = $('#<%= ddlActions.ClientID %> option:selected').val();
            if (selOption == 'C' || selOption == 'R' || selOption == 'U' || selOption == 'Q'|| selOption == 'P' || selOption == 'A') {
                var comment = $('#<%= txtComments.ClientID %>').val();
                comment = jQuery.trim(comment);
                if (comment == '') { …
Run Code Online (Sandbox Code Playgroud)

c# asp.net

4
推荐指数
1
解决办法
5227
查看次数

默认UITableview提供错误或单元格返回null

我正在设计一个自定义原型单元格,里面有很多标签,文本字段和按钮.

我在故事板上用原型单元创建了一个tableview控制器.我添加了一个objective-c tableviewcontroller类.并连接他们.Xcode添加的默认代码本身就是错误.

in.h中

@interface CreaatePlistTableViewController : UITableViewController<UITableViewDelegate, UITableViewDataSource>
Run Code Online (Sandbox Code Playgroud)

in.m

 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        static NSString *CellIdentifier = @"Cell";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

        // Configure the cell...

        return cell;
    }
Run Code Online (Sandbox Code Playgroud)

错误:

** Assertion failure in -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:], /SourceCache/UIKit_Sim/UIKit-2372/UITableView.m:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to dequeue a cell with identifier Cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
Run Code Online (Sandbox Code Playgroud)

我已将代码更改为此编译但返回一个空单元格. …

objective-c uitableview ios

3
推荐指数
1
解决办法
6595
查看次数

UITableViewController无法识别的选择器发送到实例

当我传递一个整数时,我有一个tableviewcontroller和一个detailtableviewcontroller

- [UITableViewController setSurveyNumber:]:发送到实例的无法识别的选择器

Bizard事情是完全相同的代码适用于tableviewcontroller到 - > uiviewcontroller

表 - >表格代码

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
    if([segue.identifier isEqualToString:@"pushSurveyDetails"])
    {
        NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
        NSInteger row = [indexPath row];

        SurveyDetailViewController *surveyController = [segue destinationViewController];
        surveyController.surveyNumber=row;

    }
}
Run Code Online (Sandbox Code Playgroud)

在SurveyDetailViewController.h中

@interface SurveyDetailViewController : UITableViewController
{

}

@property int surveyNumber;

@end
Run Code Online (Sandbox Code Playgroud)

SurveyDetailViewController.m

@implementation SurveyDetailViewController
@synthesize surveyNumber;
- (void)viewDidLoad
{
    [super viewDidLoad];
    NSLog(@"Survey Number is %i",surveyNumber);
}
Run Code Online (Sandbox Code Playgroud)

为什么会出现此错误?

iphone xcode uitableview ios

3
推荐指数
1
解决办法
2610
查看次数

swift强制将objective-c int指定为Int32然后崩溃

我有一个已被声明为的客观c属性

@property int xmBufferSize;
Run Code Online (Sandbox Code Playgroud)

如果我这样做sharedExample.xmBufferSize = 1024只是工作正常,但当我试图从另一个变量设置该属性的整数值

var getThat:Int = dict["bufferSize"]!.integerValue
sharedExample.xmBufferSize = getThat
Run Code Online (Sandbox Code Playgroud)

它不能做到以上

Cannot assign a value of type 'Int' to a value of type 'Int32'

如果我强迫这个

sharedExample.xmBufferSize =dict["bufferSize"] as! Int32
Run Code Online (Sandbox Code Playgroud)

它正在崩溃与错误

Could not cast value of type '__NSCFNumber' to 'Swift.Int32"

编辑::::
Dict init,除了整数之外,dict中还有其他对象

var bufferSize:Int = 1024
var dict = Dictionary<String, AnyObject>() = ["bufferSize":bufferSize]
Run Code Online (Sandbox Code Playgroud)

int objective-c ios swift

3
推荐指数
1
解决办法
2010
查看次数