youtube_explode/lib/src/exceptions/video_unplayable_exception....

37 lines
1.5 KiB
Dart
Raw Normal View History

2020-06-03 13:18:37 +02:00
import '../videos/video_id.dart';
2020-05-31 23:36:23 +02:00
import 'youtube_explode_exception.dart';
2020-02-23 21:00:35 +01:00
2020-05-31 23:36:23 +02:00
/// Exception thrown when the requested video is unplayable.
class VideoUnplayableException implements YoutubeExplodeException {
/// Description message
2020-06-05 16:17:08 +02:00
@override
2020-05-31 23:36:23 +02:00
final String message;
2020-02-23 21:00:35 +01:00
/// Initializes an instance of [VideoUnplayableException]
2020-05-31 23:36:23 +02:00
VideoUnplayableException(this.message);
2020-02-23 21:00:35 +01:00
2020-05-31 23:36:23 +02:00
/// Initializes an instance of [VideoUnplayableException] with a [VideoId]
VideoUnplayableException.unplayable(VideoId videoId, {String reason = ''})
: message = 'Video \'$videoId\' is unplayable.\n'
'Streams are not available for this video.\n'
'In most cases, this error indicates that there are \n'
'some restrictions in place that prevent watching this video.\n'
'Reason: $reason';
/// Initializes an instance of [VideoUnplayableException] with a [VideoId]
VideoUnplayableException.liveStream(VideoId videoId)
: message = 'Video \'$videoId\' is an ongoing live stream.\n'
'Streams are not available for this video.\n'
'Please wait until the live stream finishes and try again.';
/// Initializes an instance of [VideoUnplayableException] with a [VideoId]
VideoUnplayableException.notLiveStream(VideoId videoId)
: message = 'Video \'$videoId\' is not an ongoing live stream.\n'
'Live stream manifest is not available for this video';
2020-12-30 15:00:11 +01:00
@override
2021-03-11 14:20:10 +01:00
// ignore:
String toString() =>
'$runtimeType: $message'; // ignore: no_runtimetype_tostring
2020-02-23 21:00:35 +01:00
}