getPlatformMedia method
Implementation
Future<Contentdetail> getPlatformMedia(Datum content) async {
String streamtype = "DASH";
Contentdetail? contentdetail;
if (kIsWeb) {
WebBrowserInfo webBrowserInfo =
await DeviceRegistration().getDeviceInfo();
BrowserName browserName = webBrowserInfo.browserName;
// String userAgent = webBrowserInfo.userAgent!;
// if (userAgent.contains("iPhone") && userAgent.contains("CriOS")) {
// streamtype = "DASH";
// } else {
if (browserName == BrowserName.safari) {
streamtype = "HLS";
String userAgent = webBrowserInfo.userAgent!;
if (userAgent.contains("Chrome") && !userAgent.contains("iPhone")) {
streamtype = "DASH";
}
} else {
streamtype = "DASH";
}
// }
} else if (Platform.isIOS) {
streamtype = "HLS";
} else if (Platform.isAndroid) {
streamtype = "DASH";
} else {
streamtype = "DASH";
}
List<Contentdetail> contentdetails = content.contentdetails!;
for (var i = 0; i < contentdetails.length; i++) {
Contentdetail detail = contentdetails[i];
if (streamtype == detail.streamtype) {
contentdetail = detail;
break;
}
}
contentdetail ??= content.contentdetails![0];
return contentdetail;
}