0%

OSMP

主界面: MainActivity

播放界面: BasePlayer
AssetDialog 主要在这里使用
BasePlayer 中包括 UIPlayer,UIPlayer 中包括 VOCommonPlayer

Track 相关:APPCommonPlayerAssetHelper
select 之后需要调用 commitSelection
UI:AssetDialog.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
VOCommonPlayer.selectVideo(index); auto : -1
VOCommonPlayer.selectAudio(index);
VOCommonPlayer.selectSubtitle(index);
VOCommonPlayer.selectMultiTracks(int[] checkedIndexes, type); 0:Audio 1:Video 2:Subtitle
VOCommonPlayer.commitSelection();
VOCommonPlayer.clearSelection();

VOCommonPlayer.isVideoAvailable(int index);
VOCommonPlayer.isAudioAvailable(int index);
VOCommonPlayer.isSubtitleAvailable(int index);

// video 有 auto, audio 有 auto, 但无法select, subtitle 没有 auto
VOCommonPlayer.getCurrentSelection(); // 有subtitle : -1, -1, -1 无subtitle : -1, -1, -1
VOCommonPlayer.getPlayingAsset(); // 有subtitle : -1, -1, 0 无subtitle : -1, -1, -2

添加设置:
在option.xml中添加项目

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<Optionitem>
<OptionId>7003</OptionId>
<!-- enable simple player -->
<Enable>1</Enable>
<!-- 0:disable; 1:enable -->
<Platform>1</Platform>
<!-- OR operation. 1:Android; 2:iOS 4:tvOS -->
<Title>Enable simple player</Title>
<Description>Enable simple player</Description>
<UIType>1</UIType>
<!-- 1:Check box; 2:Radio button; 3:Edit box 4:Button -->
<ValueList />
<Selected>0</Selected>
<DefaultSelected>0</DefaultSelected>
</Optionitem>

AppBehaviorManagerImpl.java

1
OPTION_ENABLE_SIMPLE_PLAYER_ID                     (7003),

InputBaseFragment.java

1
2
3
4
5
6
7
8
9
if (CommonFunc.getUIPlayer()
.getBehavior()
.getOptionItemByID(OPTION_ID.OPTION_ENABLE_SIMPLE_PLAYER_ID.getValue())
.getSelect() == 1){
Intent intent = new Intent(getContext(), SimplePlayerActivity.class);
intent.putExtra(SIMPLE_PLAYER_URL, url);
startActivity(intent);
return;
}