Я использую класс VLCMediaPlayer из библиотеки MobileVLCKit, чтобы сделать приложение для потоковой передачи звука. Моя проблема заключается в том, что когда происходит ошибка (например, неправильный 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-прод 2.7.9) из MobileVLCKit вы можете реализовать 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:
[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. Сделать снимок VLCMediaPlayer (MobileVLCKit)
- 3. Как показать AlertView с другим AlertView
- 4. Как установить громкость VLCMediaPlayer на iOS?
- 5. VLCKit: VLCMediaPlayer перемещается на время
- 6. Как отключить ошибку JSHint?
- 7. Как изменить размер AlertView
- 8. WebView/AlertView
- 9. R Как отключить определенную ошибку
- 10. alertView rejectModalViewControllerAnimated
- 11. alertView теперь alertController
- 12. Как получить кнопку от alertview?
- 13. Как добавить UIStepper к AlertView
- 14. Как получить значения из alertview
- 15. Как представить AlertView из UICollectionViewCell
- 16. Как переходить с помощью AlertView?
- 17. : использование необъявленного идентификатора 'alertView'?
- 18. iOS AlertView App Extension
- 19. Отключить трейлинг-косую ошибку.
- 20. Отключить ошибку одиночного предупреждения
- 21. Возврат значения BOOL из метода делегата alertview: - (void) alertView: (UIAlertView *) alertView clickedButtonAtIndex: (NSInteger) buttonIndex
- 22. Показать AlertView, разобрать и отклонить AlertView - с GCD
- 23. Как вернуться к viewcontroller в alertview
- 24. Override alertView метод
- 25. iBeacon должен представить AlertView
- 26. Настоящий AlertView от UICollectionViewCell
- 27. AlertView, определенный вне ViewController
- 28. Показать alertView в appDelegate
- 29. AlertView with textfield - начинающий
- 30. Использование текстового ввода AlertView
Спасибо большое !! Может быть, вы можете еще раз помочь :) Как я могу поймать ошибку с делегатом, если это произойдет? Я попробовал '- (void) mediaPlayerStateChanged: (NSNotification *) aNotification', но не смог получить ошибку ... Спасибо – oleynikd
Я хочу купить вам пиво – MrBr