我正在使用MobileVLCKit庫中的VLCMediaPlayer類來創建音頻流應用程序。我的問題是,當錯誤發生(例如錯誤的流url)時,它會自動提醒自己的錯誤消息。在我的情況下,我想禁用該警報消息並顯示我自己的警報消息。如何禁用VLCMediaPlayer錯誤AlertView?
3
A
回答
11
無需從源代碼中刪除該選項! 簡單地通過這樣的球員選項:
NSArray *options = @[@"--extraintf="];
VLCMediaPlayer *player = [[VLCMediaPlayer alloc] initWithOptions:options];
0
我解決了這個通過進入VLCLibrary.m在VLC源代碼,並刪除這一行:
@"--extraintf=ios_dialog_provider"];
從_defaultOptions調用。
刪除它,再次編譯庫,你不會看到任何更多的消息。
0
近期(MobileVLCKit-PROD 2.7.9)MobileVLCKit的,你可以說
...
@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;
...
您的Dialog實現提供商經過一番對象 上實現VLCCustomDialogRendererProtocol可以顯示任何對話或任何對話。 「只是登錄但什麼也沒有顯示」代表方法的示例
#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:
[email protected]"VLCDialogQuestionNormal";
break;
case VLCDialogQuestionWarning:
[email protected]"VLCDialogQuestionWarning";
break;
case VLCDialogQuestionCritical:
[email protected]"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);
}
相關問題
- 1. 如何靜音VLCMediaPlayer
- 2. 如何禁用iPhone中的alertview按鈕?
- 3. AlertView錯誤預期「:」
- 4. 如何禁用錯誤antlr3
- 5. 使快照VLCMediaPlayer(MobileVLCKit)
- 6. 如何從alertview
- 7. 以編程方式禁用Alertview
- 8. 如何禁用第一alertview的其他按鈕
- 9. UIAlertController在生成alertview時給出錯誤
- 10. 如何調整AlertView
- 11. 如何禁用MySQL的錯誤?
- 12. 如何禁用jquery.validate錯誤指示
- 13. 如何禁用「TWebbrowser」上的javascript錯誤?
- 14. 如何禁用NetBeans錯誤徽章?
- 15. 如何禁用月食註釋錯誤
- 16. 如何禁用JavaScript錯誤信息?
- 17. 如何通過目錄禁用錯誤?
- 18. 如何使用另一個AlertView顯示AlertView
- 19. 禁用serialEvent錯誤?
- 20. 禁用cshtml錯誤
- 21. DatePicker禁用錯誤
- 22. 禁用eslint錯誤
- 23. AlertView裏面的alertView
- 24. 如何alertview IOS刪除%20
- 25. 如何將TextField放入AlertView?
- 26. 如何檢查alertview值
- 27. 錯誤:使用未聲明的標識符'alertView'?
- 28. 如何使用筆尖創建僞alertview?
- 29. 如何使用alertview刷新uitableivew?
- 30. 如何使用3個TextField創建AlertView
非常感謝!也許你可以再次提供幫助:)如果發生錯誤,我怎樣才能在委託中發現錯誤?我試過' - (void)mediaPlayerStateChanged:(NSNotification *)aNotification'但未能檢索到錯誤...謝謝 – oleynikd 2015-12-29 11:44:17
我想給你買一瓶啤酒 – MrBr 2017-04-06 21:00:59