헤더 - X-Device-Info header-x-device-info
개요 overview
X-Device-Info 요청 헤더에는 실제 스트리밍 장치와 관련된 클라이언트 정보(장치, 연결 및 응용 프로그램)가 포함되어 있으며 MVPD가 적용할 수 있는 플랫폼별 규칙을 결정하는 데 사용됩니다.
구문 syntax
지시문 directives
<device_information>
다음 표에 필요한 것으로 표시된 특성을 적어도 포함하는 JSON 요소의 Base64-encoded
값입니다.
예시 examples
// Device information
// {
// "primaryHardwareType" : "MobilePhone",
// "model":"SM-S901U",
// "vendor":"samsung",
// "version":"r0q",
// "manufacturer":"samsung",
// "osName":"Android",
// "osVersion":"14"
// }
// BASE64-encoded
// ewogICJwcmltYXJ5SGFyZHdhcmVUeXBlIiA6ICJNb2JpbGVQaG9uZSIsCiAgIm1vZGVsIjoiU00tUzkwMVUiLAogICJ2ZW5kb3I
// iOiJzYW1zdW5nIiwKICAidmVyc2lvbiI6InIwcSIsCiAgIm1hbnVmYWN0dXJlciI6InNhbXN1bmciLAogICJvc05hbWUiOiJBbmRyb
// 2lkIiwKICAib3NWZXJzaW9uIjoiMTQiCn0=
X-Device-Info: ewogICJwcmltYXJ5SGFyZHdhcmVUeXBlIiA6ICJNb2JpbGVQaG9uZSIsCiAgIm1vZGVsIjoiU00tUzkwMVUiLAogICJ2ZW5kb3IiOiJzYW1zdW5nIiwKICAidmVyc2lvbiI6InIwcSIsCiAgIm1hbnVmYWN0dXJlciI6InNhbXN1bmciLAogICJvc05hbWUiOiJBbmRyb2lkIiwKICAib3NWZXJzaW9uIjoiMTQiCn0=
요리책 cookbooks
X-Device-Info
헤더에는 지시문 섹션에 설명된 대로 형식이 지정된 값이 있어야 합니다.브라우저 browsers
브라우저에서 실행 중인 클라이언트 응용 프로그램의 경우 브라우저에서 User-Agent
헤더에 필요한 최소 정보 집합을 자동으로 보내므로 X-Device-Info
헤더를 생략할 수 있습니다.
클라이언트 응용 프로그램이 장치 식별 메커니즘을 제공하는 라이브러리 또는 서비스를 통합하는 경우 X-Device-Info
헤더를 사용하여 장치, 연결 및 응용 프로그램에 대한 추가 정보를 제공할 수 있습니다.
모바일 장치 mobile-devices
iOS 및 iPadOS ios-ipados
iOS 또는 iPadOS를 실행하는 장치의 X-Device-Info
헤더를 빌드하려면 다음 문서와 코드 조각 아래를 참조하십시오.
+ (NSString *)computeClientInformation {
struct utsname u;
uname(&u);
NSString *hardware = [NSString stringWithCString:u.machine encoding:NSUTF8StringEncoding];
UIDevice *device = [UIDevice currentDevice];
NSString *deviceType;
switch (UI_USER_INTERFACE_IDIOM()) {
case UIUserInterfaceIdiomPhone:
deviceType = @"MobilePhone";
break;
case UIUserInterfaceIdiomPad:
deviceType = @"Tablet";
break;
case UIUserInterfaceIdiomTV:
deviceType = @"TV";
break;
default:
deviceType = @"Unknown";
}
CGRect screenRect = [[UIScreen mainScreen] bounds];
NSNumber *screenWidth = @((float) screenRect.size.width);
NSNumber *screenHeight = @((float) screenRect.size.height);
Reachability *reachability = [Reachability reachabilityForInternetConnection];
[reachability startNotifier];
NetworkStatus status = [reachability currentReachabilityStatus];
NSString *connectionType;
if (status == NotReachable) {
connectionType = @"notConnected";
} else if (status == ReachableViaWiFi) {
connectionType = @"WiFi";
} else if (status == ReachableViaWWAN) {
connectionType = @"cellular";
}
NSMutableDictionary *clientInformation = [@{
@"type": deviceType,
@"model": device.model,
@"vendor": @"Apple",
@"manufacturer": @"Apple",
@"version": [hardware stringByReplacingOccurrencesOfString:device.model withString:@""],
@"osName": device.systemName,
@"osVersion": device.systemVersion,
@"displayWidth": screenWidth,
@"displayHeight": screenHeight,
@"connectionType": connectionType,
@"applicationId": @"REF30"
} mutableCopy];
NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:clientInformation options:NSJSONWritingPrettyPrinted error:&error];
NSString *base64Encoded = [jsonData base64EncodedStringWithOptions:0];
return base64Encoded;
}
장치 정보는 다음과 같은 방법으로 구성할 수 있습니다.
연결 정보는 다음과 같은 방법으로 구성할 수 있습니다.
애플리케이션 정보는 다음과 같은 방법으로 구성할 수 있습니다.
Android android
Android을(를) 실행하는 장치의 X-Device-Info
헤더를 빌드하려면 다음 문서와 코드 조각 아래를 참조할 수 있습니다.
- Build 클래스에 대한 Android 개발자 설명서입니다.
private JSONObject computeClientInformation() {
String LOGGING_TAG = "DefineClass.class";
JSONObject clientInformation = new JSONObject();
String connectionType;
try {
ConnectivityManager cm = (ConnectivityManager) getContext().getSystemService(CONNECTIVITY_SERVICE);
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
if (activeNetwork != null && activeNetwork.isConnectedOrConnecting()) {
switch (activeNetwork.getType()) {
case ConnectivityManager.TYPE_WIFI: {
connectionType = "WIFI";
break;
}
case ConnectivityManager.TYPE_BLUETOOTH: {
connectionType = "BLUETOOTH";
break;
}
case ConnectivityManager.TYPE_MOBILE: {
connectionType = "MOBILE";
break;
}
case ConnectivityManager.TYPE_ETHERNET: {
connectionType = "ETHERNET";
break;
}
case ConnectivityManager.TYPE_VPN: {
connectionType = "VPN";
break;
}
case ConnectivityManager.TYPE_DUMMY: {
connectionType = "DUMMY";
break;
}
case ConnectivityManager.TYPE_MOBILE_DUN: {
connectionType = "MOBILE_DUN";
break;
}
case ConnectivityManager.TYPE_WIMAX: {
connectionType = "WIMAX";
break;
}
default:
connectionType = ConnectivityManager.EXTRA_OTHER_NETWORK_INFO;
}
} else {
connectionType = ConnectivityManager.EXTRA_NO_CONNECTIVITY;
}
} catch (Exception e) {
connectionType = "notAccessible";
}
try {
clientInformation.put("model", Build.MODEL);
clientInformation.put("vendor", Build.BRAND);
clientInformation.put("manufacturer", Build.MANUFACTURER);
clientInformation.put("version", Build.DEVICE);
clientInformation.put("osName", "Android");
clientInformation.put("osVersion", Build.VERSION.RELEASE);
clientInformation.put("connectionType", connectionType);
clientInformation.put("applicationId", "REF30");
} catch (JSONException e) {
Log.e(LOGGING_TAG, e.getMessage());
}
return Base64.encodeToString(clientInformation.toString().getBytes(), Base64.NO_WRAP);
}
장치 정보는 다음과 같은 방법으로 구성할 수 있습니다.
연결 정보는 다음과 같은 방법으로 구성할 수 있습니다.
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
getSystemService(Context.CONNECTIVITY_SERVICE).getActiveNetworkInfo().getType()
"WIFI","BLUETOOTH","MOBILE","ETHERNET","VPN","DUMMY","MOBILE_DUN","WIMAX","notAccessible"
애플리케이션 정보는 다음과 같은 방법으로 구성할 수 있습니다.
TV 연결 장치 tv-connected-devices
tvOS tvos
tvOS을(를) 실행하는 장치의 X-Device-Info
헤더를 빌드하려면 다음 문서와 코드 조각 아래를 참조하십시오.
+ (NSString *)computeClientInformation {
struct utsname u;
uname(&u);
NSString *hardware = [NSString stringWithCString:u.machine encoding:NSUTF8StringEncoding];
UIDevice *device = [UIDevice currentDevice];
NSString *deviceType;
switch (UI_USER_INTERFACE_IDIOM()) {
case UIUserInterfaceIdiomPhone:
deviceType = @"MobilePhone";
break;
case UIUserInterfaceIdiomPad:
deviceType = @"Tablet";
break;
case UIUserInterfaceIdiomTV:
deviceType = @"TV";
break;
default:
deviceType = @"Unknown";
}
CGRect screenRect = [[UIScreen mainScreen] bounds];
NSNumber *screenWidth = @((float) screenRect.size.width);
NSNumber *screenHeight = @((float) screenRect.size.height);
Reachability *reachability = [Reachability reachabilityForInternetConnection];
[reachability startNotifier];
NetworkStatus status = [reachability currentReachabilityStatus];
NSString *connectionType;
if (status == NotReachable) {
connectionType = @"notConnected";
} else if (status == ReachableViaWiFi) {
connectionType = @"WiFi";
} else if (status == ReachableViaWWAN) {
connectionType = @"cellular";
}
NSMutableDictionary *clientInformation = [@{
@"type": deviceType,
@"model": device.model,
@"vendor": @"Apple",
@"manufacturer": @"Apple",
@"version": [hardware stringByReplacingOccurrencesOfString:device.model withString:@""],
@"osName": device.systemName,
@"osVersion": device.systemVersion,
@"displayWidth": screenWidth,
@"displayHeight": screenHeight,
@"connectionType": connectionType,
@"applicationId": @"REF30"
} mutableCopy];
NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:clientInformation options:NSJSONWritingPrettyPrinted error:&error];
NSString *base64Encoded = [jsonData base64EncodedStringWithOptions:0];
return base64Encoded;
}
장치 정보는 다음과 같은 방법으로 구성할 수 있습니다.
연결 정보는 다음과 같은 방법으로 구성할 수 있습니다.
애플리케이션 정보는 다음과 같은 방법으로 구성할 수 있습니다.
Fire OS fireos
Fire OS를 실행하는 장치의 X-Device-Info
헤더를 빌드하려면 다음 문서를 참조할 수 있습니다.
- Build 클래스에 대한 Android 개발자 설명서입니다.
- Fire TV 장치 식별을 위한 Amazon 개발자 설명서입니다.
장치 정보는 다음과 같은 방법으로 구성할 수 있습니다.
연결 정보는 다음과 같은 방법으로 구성할 수 있습니다.
애플리케이션 정보는 다음과 같은 방법으로 구성할 수 있습니다.
Roku 운영 체제 rokuos
Roku OS를 실행하는 장치의 X-Device-Info
헤더를 만들려면 다음 문서를 참조할 수 있습니다.
- ifDeviceInfo에 대한 Roku 개발자 설명서.
장치 정보는 다음과 같은 방법으로 구성할 수 있습니다.
연결 정보는 다음과 같은 방법으로 구성할 수 있습니다.
애플리케이션 정보는 다음과 같은 방법으로 구성할 수 있습니다.
기타 others
설명서에서 다루지 않는 장치 플랫폼의 경우 클라이언트 정보(장치, 연결 및 애플리케이션)는 일반적으로 장치의 하드웨어 및 OS 설명서에 지정된 사용 가능한 하드웨어 및 운영 체제(OS) 속성에 연결되어야 합니다.