Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/117.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何禁用VLCMediaPlayer错误警报视图?_Ios_Vlc_Libvlc - Fatal编程技术网

Ios 如何禁用VLCMediaPlayer错误警报视图?

Ios 如何禁用VLCMediaPlayer错误警报视图?,ios,vlc,libvlc,Ios,Vlc,Libvlc,我正在使用MobileVLCKit库中的VLCMediaPlayer类来制作音频流应用程序。我的问题是,当发生错误时(例如,错误的流url),它会自动提醒自己的错误消息。在我的例子中,我想禁用该警报消息并显示我自己的警报消息 我通过在VLC源代码中转到VLCLibrary.m并删除这一行来解决这个问题: @"--extraintf=ios_dialog_provider"]; 从defaultOptions调用 删除它,重新编译库,您将不会看到更多消息。无需从源代码中删除此选项! 只需按如下方

我正在使用MobileVLCKit库中的VLCMediaPlayer类来制作音频流应用程序。我的问题是,当发生错误时(例如,错误的流url),它会自动提醒自己的错误消息。在我的例子中,我想禁用该警报消息并显示我自己的警报消息


我通过在VLC源代码中转到VLCLibrary.m并删除这一行来解决这个问题:

@"--extraintf=ios_dialog_provider"];
从defaultOptions调用


删除它,重新编译库,您将不会看到更多消息。

无需从源代码中删除此选项! 只需按如下方式传递播放器选项:

NSArray *options = @[@"--extraintf="];
VLCMediaPlayer *player = [[VLCMediaPlayer alloc] initWithOptions:options];
使用MobileVLCKit的最新版本(MobileVLCKit prod 2.7.9),您可以在某些对象上实现VLCCustomDialogRendererProtocol 之后

...
@property (nonatomic, strong) VLCDialogProvider * dialogProvider;
....
        //dump information
        VLCLibrary * lib=[VLCLibrary sharedLibrary];

        //configure dialog provider
        self.dialogProvider=[[VLCDialogProvider alloc] initWithLibrary:lib customUI:YES];
        self.dialogProvider.customRenderer=self;

...
对话框提供程序的实现可以显示它喜欢的任何对话框,或者根本不显示任何对话框。 委托方法的“只记录但不显示”版本示例

#pragma mark - VLCCustomDialogRendererProtocol methods

/**
 * called when VLC wants to show an error
 * \param the dialog title
 * \param the error message
 */
- (void)showErrorWithTitle:(NSString * _Nonnull)error
                   message:(NSString * _Nonnull)message {
    CLogERROR(LOGDOMAIN_MINIPLAYER,@"VLC Error:%@:%@",error,message);
}

/**
 * called when user logs in to something
 * If VLC includes a keychain module for your platform, a user can store stuff
 * \param login title
 * \param an explaining message
 * \param a default username within context
 * \param indicator whether storing is even a possibility
 * \param reference you need to send the results to
 */
- (void)showLoginWithTitle:(NSString * _Nonnull)title
                   message:(NSString * _Nonnull)message
           defaultUsername:(NSString * _Nullable)username
          askingForStorage:(BOOL)askingForStorage
             withReference:(NSValue * _Nonnull)reference {

    CLogWARN(LOGDOMAIN_MINIPLAYER,@"VLC login request:title:%@,message:%@,username:%@ reference:%@",title,message,username,reference);
    //we should respond with postUsername... but we can't...and we are not supposed to so anyway

}

/**
 * called when VLC needs the user to decide something
 * \param the dialog title
 * \param an explaining message text
 * \param a question type
 * \param cancel button text
 * \param action 1 text
 * \param action 2 text
 * \param reference you need to send the action to
 */
- (void)showQuestionWithTitle:(NSString * _Nonnull)title
                      message:(NSString * _Nonnull)message
                         type:(VLCDialogQuestionType)questionType
                 cancelString:(NSString * _Nullable)cancelString
                action1String:(NSString * _Nullable)action1String
                action2String:(NSString * _Nullable)action2String
                withReference:(NSValue * _Nonnull)reference {

    NSString * questionTypeString;
    switch (questionType) {
        case VLCDialogQuestionNormal:
            questionTypeString=@"VLCDialogQuestionNormal";
            break;
        case VLCDialogQuestionWarning:
            questionTypeString=@"VLCDialogQuestionWarning";
            break;
        case VLCDialogQuestionCritical:
            questionTypeString=@"VLCDialogQuestionCritical";
            break;
    }
    CLogWARN(LOGDOMAIN_MINIPLAYER,@"VLC Question:Type:%@ Title:%@ Message:%@, cancel:%@,action1:%@,action2:%@,reference:%@",
              questionTypeString, title,message,cancelString,action1String,action2String,reference);
    //just cancel
    [self.dialogProvider postAction:3 forDialogReference:reference];
}

/**
 * called when VLC wants to show some progress
 * \param the dialog title
 * \param an explaining message
 * \param indicator whether progress indeterminate
 * \param initial progress position
 * \param optional string for cancel button if operation is cancellable
 * \param reference VLC will include in updates
 */
- (void)showProgressWithTitle:(NSString * _Nonnull)title
                      message:(NSString * _Nonnull)message
              isIndeterminate:(BOOL)isIndeterminate
                     position:(float)position
                 cancelString:(NSString * _Nullable)cancelString
                withReference:(NSValue * _Nonnull)reference {
    CLogWARN(LOGDOMAIN_MINIPLAYER,@"VLC Progress:Title:%@ Message:%@, cancel:%@, position:%f,reference %@",title,message,cancelString,position,reference);
    //just try to cancel
    [self.dialogProvider dismissDialogWithReference:reference];

}

/** called when VLC wants to update an existing progress dialog
 * \param reference to the existing progress dialog
 * \param updated message
 * \param current position
 */
- (void)updateProgressWithReference:(NSValue * _Nonnull)reference
                            message:(NSString * _Nullable)message
                            postion:(float)position {
    CLogWARN(LOGDOMAIN_MINIPLAYER,@"VLC Progress update:Message:%@,  position:%f,reference:%@",message,position,reference);
    //just try to cancel
    [self.dialogProvider dismissDialogWithReference:reference];
}

/** VLC decided to destroy a dialog
 * \param reference to the dialog to destroy
 */
- (void)cancelDialogWithReference:(NSValue * _Nonnull)reference {
    CLogWARN(LOGDOMAIN_MINIPLAYER,@"VLC cancel dialog,referecne %@... ok",reference);
}

谢谢!!也许您可以再次提供帮助:)如果发生委托错误,我如何捕获该错误?我尝试了
-(void)mediaPlayerStateChanged:(NSNotification*)加密
,但检索错误失败。。。谢谢我想请你喝杯啤酒