# 频道设置

本文档主要讲述 `频道模块(channel)` 提供的频道设置相关的 API 文档，详细内容见下文：

## 一、观看页设置

### 1.1 获取观看页设置

用于获取管理后台设置的观看页设置信息。

**Api 方法：** `getWatchSetting(): ChannelWatchSetting`

**返回值说明：** 频道观看页设置，`ChannelWatchSetting` 类型，详细类型说明如下

| 属性名                  | 说明       | 类型        |
| -------------------- | -------- | --------- |
| `watchEnabled`       | 观看页开关    | `boolean` |
| `mobileWatchEnabled` | 移动端观看页开关 | `boolean` |
| `splashEnabled`      | 引导页开关    | `boolean` |

**示例：**

```js
const setting = watchCore.channel.getWatchSetting();
if (!setting.watchEnabled) { alert('当前观看页暂未开放'); }
if (isMobile && !setting.mobileWatchEnabled) { alert('暂不支持移动端观看'); }
```

## 二、页面广告

### 2.1 获取频道页面广告设置

用于获取管理后台设置的页面广告设置信息。

从 v1.2.0 开始可以通过 `PlvChannelModule.generateDefaultPageAdvertSetting()` 来获取默认配置

**Api 方法：** `getPageAdvertSetting(): ChannelAdvertSetting`

**返回值说明：** 频道页面广告设置，`ChannelAdvertSetting` 类型，详细类型说明如下

| 属性名                  | 说明       | 类型                 |
| -------------------- | -------- | ------------------ |
| `pageAdvertEnabled`  | 页面广告开关   | `boolean`          |
| `closeAdvertEnabled` | 允许关闭页面广告 | `boolean`          |
| `pageAdvertList`     | 页面广告列表   | `PageAdvertItem[]` |

**示例：**

```js
const setting = watchCore.channel.getPageAdvertSetting();
console.log('页面广告开关：', setting.pageAdvertEnabled);
console.log('允许关闭页面广告：', setting.closeAdvertEnabled);
```

### 2.2 获取频道页面广告列表

用于获取管理后台设置的页面广告列表。

**Api 方法：** `getPageAdvertList(): PageAdvertItem[]`

**返回值说明：** 广告列表，`PageAdvertItem[]` 类型

**示例：**

```js
const advertList = watchCore.channel.getPageAdvertList();
advertList.forEach((item, index) => {
  console.log('广告内容', index, item.content);
  console.log('广告类型', index, item.advertType); // PageAdvertType
  console.log('跳转地址', index, item.href);
});
```

**Interface 接口：** `PageAdvertItem` 页面广告信息

| 属性名          | 说明   | 类型               |
| ------------ | ---- | ---------------- |
| `content`    | 广告内容 | `string`         |
| `advertType` | 广告类型 | `PageAdvertType` |
| `href`       | 跳转地址 | `string`         |

**Enum 枚举：** `PageAdvertType` 页面广告类型

| 常量        | 枚举成员                   | 说明   |
| --------- | ---------------------- | ---- |
| `'text'`  | `PageAdvertType.Text`  | 文字广告 |
| `'image'` | `PageAdvertType.Image` | 图片广告 |

## 三、页脚

### 3.1 获取频道页脚设置

用于获取管理后台的页脚信息。

**Api 方法：** `getPageFooterSetting(): ChannelPageFooterSetting`

**返回值说明：** 页脚设置，`ChannelPageFooterSetting` 类型，详细类型说明如下

| 属性名                      | 说明                                             | 类型        |
| ------------------------ | ---------------------------------------------- | --------- |
| `footerEnabled`          | 页脚开关                                           | `boolean` |
| `footerText`             | 页脚文案                                           | `string`  |
| `footerLink`             | 页脚完整链接                                         | `string`  |
| `footerTextLinkProtocol` | 页脚链接域名，如：https\://                             | `string`  |
| `footerTextLinkUrl`      | 页脚链接地址，如：[www.polyv.net](http://www.polyv.net) | `string`  |

**示例：**

```js
const footerSetting = watchCore.channel.getPageFooterSetting();
console.log('页脚开关：', footerSetting.footerEnabled);
console.log('页脚文案：', footerSetting.footerText);
console.log('页脚链接：', footerSetting.footerLink);
```

## 四、公众号关注

### 4.1 获取频道关注设置

用于获取管理后台的关注设置信息。

**Api 方法：** `getFollowSetting(): ChannelFollowSetting`

**返回值说明：** 频道关注设置，`ChannelFollowSetting` 类型，详细类型说明如下

| 属性名              | 说明     | 类型                    |
| ---------------- | ------ | --------------------- |
| `followEnabled`  | 关注开关   | `boolean`             |
| `followAutoShow` | 主动弹窗   | `boolean`             |
| `followEntrance` | 入口文案   | `string`              |
| `followImage`    | 二维码图片  | `undefined \| string` |
| `followTips`     | 弹窗提示文案 | `undefined \| string` |

**示例：**

```js
const setting = watchCore.channel.getFollowSetting();
console.log('关注开关：', setting.followEnabled);
console.log('入口文案：', setting.followEntrance);
console.log('二维码图片：', setting.followImage);
```

## 五、多语言

### 5.1 获取频道多语言设置

用于获取后台的多语言设置信息。

**Api 方法：** `getLangSetting(): ChannelLangSetting`

**返回值说明：** 频道多语言设置，`ChannelLangSetting` 类型，详细类型说明如下

| 属性名                      | 说明               | 类型             |
| ------------------------ | ---------------- | -------------- |
| `preferRecommendSetting` | 优先使用推荐配置         | `boolean`      |
| `englishSettingEnabled`  | 双语界面开关           | `boolean`      |
| `langSwitchEnabled`      | 多语言开关            | `boolean`      |
| `isShowSevenLanguage`    | 是否显示七国多语言        | `boolean`      |
| `japLangEnabled`         | 是否将英文选择文案替换成日语文案 | `boolean`      |
| `isFollowBrowserLang`    | 是否跟随浏览器语言        | `boolean`      |
| `defaultLangType`        | 观看页默认配置的语言类型     | `LanguageType` |

**示例：**

```js
const setting = watchCore.channel.getLangSetting();
console.log('多语言开关：', setting.langSwitchEnabled);
console.log('双语界面开关：', setting.englishSettingEnabled);
console.log('是否跟随浏览器语言：', setting.isFollowBrowserLang);
console.log('默认的语言类型：', setting.defaultLangType);
```

## 六、页面布局

### 6.1 获取频道布局设置

用于获取管理后台的页面布局相关设置。

**Api 方法：** `getLayoutSetting(): ChannelLayoutSetting`

**返回值说明：** 频道布局设置，`ChannelLayoutSetting` 类型，详细类型说明如下

| 属性名                    | 说明         | 类型                     |
| ---------------------- | ---------- | ---------------------- |
| `mainScreenLayoutMode` | 三分屏主屏幕布局模式 | `MainScreenLayoutMode` |
| `mobileSplashLayout`   | 移动端引导页布局   | `MobileSplashLayout`   |
| `mobileWatchLayout`    | 移动端观看页布局   | `MobileWatchLayout`    |

**示例：**

```js
const setting = watchCore.channel.getLayoutSetting();
console.log('三分屏主屏布局模式：', setting.mainScreenLayoutMode);
console.log('移动端引导页布局：', setting.mobileSplashLayout);
console.log('移动端观看页页布局：', setting.mobileWatchLayout);
```

## 七、皮肤主题

### 7.1 获取频道皮肤主题设置

用于获取管理后台的皮肤主题设置。

从 v1.2.0 开始可以通过 `PlvChannelModule.generateDefaultThemeSetting()` 来获取默认配置

**Api 方法：** `getThemeSetting(): ChannelThemeSetting`

**返回值说明：** 频道皮肤主题设置，`ChannelThemeSetting` 类型，详细类型说明如下

| 属性名                                  | 说明               | 类型                     |
| ------------------------------------ | ---------------- | ---------------------- |
| `pageSkin`                           | 观看页皮肤            | `ChannelWatchPageSkin` |
| `browserFavIcon`                     | 浏览器标签页图标         | `string`               |
| `channelCoverImg`                    | 频道图标图片地址         | `string`               |
| `splashImg`                          | 引导页封面图           | `string`               |
| `mobileSplashLargeImg`               | 移动端引导页大图         | `string`               |
| `pcWatchBackgroundImage`             | PC 端观看页背景图       | `undefined \| string`  |
| `mobileChatBackgroundImage`          | 移动端聊天室背景图        | `undefined \| string`  |
| `mobileChatBackgroundImageAmbiguity` | 聊天室背景图模糊，0 ～ 100 | `undefined \| number`  |
| `portraitBackgroundImage`            | 竖屏背景图            | `undefined \| string`  |
| `portraitBackgroundImageAmbiguity`   | 竖屏背景图透明度，0 ～ 100 | `undefined \| number`  |

**示例：**

```js
const setting = watchCore.channel.getThemeSetting();
console.log('皮肤风格：', setting.pageSkin);
console.log('直播间图标：', setting.channelCoverImg);
```

## 八、流多轨配置/双流配置

### 8.1 获取频道流多轨配置

多轨配置和多线路不同，多线路获取的其实还是同个源，但是多轨是获取不同的推流来源

**Api 方法：** `getChannelStreamTrackConfig(): ChannelStreamTrackConfig`

**返回值说明：** 频道流多轨配置（双流），`ChannelStreamTrackConfig` 类型，详细类型说明如下

| 属性名         | 说明    | 类型                         |
| ----------- | ----- | -------------------------- |
| `type`      | 多轨配置类 | `ChannelStreamTrackType`   |
| `trackList` | 多轨列表  | `ChannelStreamTrackItem[]` |

## 九、其他开关

### 9.1 获取在线列表开关

**Api 方法：** `getOnlineListEnabled(): boolean`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://polyv.gitbook.io/document/docs/live/js/new-sdk/live-watch-sdk/articles/modules/channel/channel-setting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
