//APP端视频播放v1接口
syntax = "proto3";

package bilibili.app.playurl.v1;

//视频url
service PlayURL {
    //获取播放界面配置
    //https://app.bilibili.com/bilibili.app.playurl.v1.PlayURL/PlayConf
    rpc PlayConf (PlayConfReq) returns (PlayConfReply);

    //
    //
    rpc PlayConfEdit (PlayConfEditReq) returns (PlayConfEditReply);

    //获取视频url
    //
    rpc PlayURL (PlayURLReq) returns (PlayURLReply);

    //获取视频播放业务数据
    //https://app.bilibili.com/bilibili.app.playurl.v1.PlayURL/PlayView
    rpc PlayView (PlayViewReq) returns (PlayViewReply);

    //
    //
    rpc Project (ProjectReq) returns (ProjectReply);
}

//获取播放界面配置-请求
message PlayConfReq {

}

//获取播放界面配置-回复
message PlayConfReply {
	//播放控件用户自定义配置
    PlayAbilityConf playConf = 1;
}

//-请求
message PlayConfEditReq {
    //
    repeated PlayConfState playConf = 1;
}

//-回复
message PlayConfEditReply {

}

//视频url-请求
message PlayURLReq {
	//稿件avid
    int64 aid = 1;
    
    //视频cid
    int64 cid = 2;
    
    //清晰度
    int64 qn = 3;
    
    //视频流版本
    int32 fnver = 4;
    
    //视频流功能
    int32 fnval = 5;
    
    //下载模式
    //0:播放 1:flv下载 2:dash下载
    uint32 download = 6;
    
    //流url强制是用域名
    //0:允许使用ip 1:使用http 2:使用https
    int32 forceHost = 7;
    
    //允许4K
    bool fourk = 8;
    
    //
    string spmid = 9;
    
    //
    string fromSpmid = 10;
}

//视频url-回复
message PlayURLReply {
    //
    uint32 quality = 1;

    //
    string format = 2;

    //
    uint64 timelength = 3;

    //
    uint32 videoCodecid = 4;

    //
    uint32 fnver = 5;

    //
    uint32 fnval = 6;

    //
    bool videoProject = 7;

    //
    repeated ResponseUrl durl = 8;

    //
    ResponseDash dash = 9;

    //
    int32 noRexcode = 10;

    //
    UpgradeLimit upgradeLimit = 11;

    //
    repeated FormatDescription supportFormats = 12;

    //
    VideoType type = 13;
}

//获取视频播放业务数据-请求
message PlayViewReq {
    //稿件avid
    int64 aid = 1;
        
    //视频cid
    int64 cid = 2;

    //清晰度
    int64 qn = 3;

    //流类型
    int32 fnver = 4;

    //
    int32 fnval = 5;

    //下载模式
    //0:播放 1:flv下载 2:dash下载
    uint32 download = 6;

    //流url强制是用域名
    //0:允许使用ip 1:使用http 2:使用https
    int32 forceHost = 7;

    //允许4K
    bool fourk = 8;

    //
    string spmid = 9;

    //
    string fromSpmid = 10;

    //
    int32 teenagersMode = 11;

    //
    CodeType preferCodecType = 12;
}

//获取视频播放业务数据-回复
message PlayViewReply {
	//视频流信息
    VideoInfo info = 1;
    
    //播放控件用户自定义配置
    PlayAbilityConf PlayConf = 2;
    
    //互动视频升级提示
    UpgradeLimit upgradeLimit = 3;
    
    //
    Chronos chronos = 4;
    
    //播放控件稿件配置
    PlayArcConf playArc = 5;
    
    //事件
    Event event = 6;
}

//-请求
message ProjectReq {
    //稿件avid
    int64 aid = 1;
        
    //视频cid
    int64 cid = 2;

    //清晰度
    int64 qn = 3;

    //流类型
    int32 fnver = 4;

    //
    int32 fnval = 5;

    //下载模式
    //0:播放 1:flv下载 2:dash下载
    uint32 download = 6;

    //流url强制是用域名
    //0:允许使用ip 1:使用http 2:使用https
    int32 forceHost = 7;

    //允许4K
    bool fourk = 8;

    //
    string spmid = 9;

    //
    string fromSpmid = 10;

    //
    int32 protocol = 11;

    //
    int32 deviceType = 12;
}

//-回复
message ProjectReply {
    //
    PlayURLReply project = 1;
}

//配置项
message ArcConf {
	//是否开启
	bool isSupport=1;
}

//
message Chronos {
	//
    string md5=1;
    
    //
    string file=2;
}

//
message CloudConf {
    //
    bool show = 1;

    //
    ConfType confType = 2;

    //
    FieldValue fieldValue = 3;
}

//编码类型
enum CodeType {
    //默认
	NOCODE = 0;

    //H.264
	CODE264 = 1;

    //H.265
	CODE265 = 2;
}

//
enum ConfType {
    //
    NoType_VALUE = 0;

    //
    FLIPCONF_VALUE = 1;

    //
    CASTCONF_VALUE = 2;

    //
    FEEDBACK_VALUE = 3;

    //
    SUBTITLE_VALUE = 4;

    //
    PLAYBACKRATE_VALUE = 5;

    //
    TIMEUP_VALUE = 6;

    //
    PLAYBACKMODE_VALUE = 7;

    //
    SCALEMODE_VALUE = 8;

    //
    BACKGROUNDPLAY_VALUE = 9;

    //
    LIKE_VALUE = 10;

    //
    DISLIKE_VALUE = 11;

    //
    COIN_VALUE = 12;

    //
    ELEC_VALUE = 13;

    //
    SHARE_VALUE = 14;

    //
    SCREENSHOT_VALUE = 15;

    //
    LOCKSCREEN_VALUE = 16;

    //
    RECOMMEND_VALUE = 17;

    //
    PLAYBACKSPEED_VALUE = 18;

    //
    DEFINITION_VALUE = 19;

    //
    SELECTIONS_VALUE = 20;

    //
    NEXT_VALUE = 21;

    //
    EDITDM_VALUE = 22;

    //
    SMALLWINDOW_VALUE = 23;

    //
    SHAKE_VALUE = 24;

    //
    OUTERDM_VALUE = 25;

    //
    INNERDM_VALUE = 26;

    //
    PANORAMA_VALUE = 27;

    //
    DOLBY_VALUE = 28;
}

//
message DashItem {
	//
	uint32 id=1;
	
	//主线流
	string baseUrl=2;
	
	//备用流
	repeated string backupUrl=3;
	
	//带宽
	uint32 bandwidth=4;
	
	//
	uint32 codecid=5;
	
	//md5
	string md5=6;
	
	//大小
	uint64 size=7;
}

//dash视频流
message DashVideo {
	//主线流
	string baseUrl=1;
	
	//备用流
	repeated string backupUrl=2;
	
	//带宽
	uint32 bandwidth=3;
	
	//
	uint32 codecid=4;
	
	//md5
	string md5=5;
	
	//大小
	uint64 size=6;
	
	//
	uint32 audioId=7;
	
	//是否非全二压
	bool noRexcode=8;
}

//杜比音频信息
message DolbyItem {
	//
	int32 type=1;
	
	//音频流
	DashItem audio=2;
}

//事件
message Event {
	//震动
    Shake shake=1;
}

//
message FieldValue {
    //
    oneof valueCase {
        //
        bool value = 1;
    }
}

//
message FormatDescription {
    //
    int32 quality = 1;

    //
    string format = 2;

    //
    string description = 3;

    //
    string newDescription = 4;

    //
    string displayDesc = 5;

    //
    string superscript = 6;
}

//禁用功能配置
message PlayAbilityConf {
    //后台播放
    bool backgroundPlayDisable=1;

    //镜像反转
    bool flipDisable=2;

    //投屏
    bool castDisable=3;

    //反馈
    bool feedbackDisable=4;

    //字幕
    bool subtitleDisable=5;

    //播放速度
    bool playbackRateDisable=6;

    //定时停止
    bool timeUpDisable=7;

    //播放方式
    bool playbackModeDisable=8;

    //画面尺寸
    bool scaleModeDisable=9;

    //赞
    bool likeDisable=10;

    //踩
    bool dislikeDisable=11;

    //投币
    bool coinDisable=12;

    //充电
    bool elecDisable=13;

    //分享
    bool shareDisable=14;

    //截图
    bool screenShotDisable=15;

    //锁定
    bool lockScreenDisable=16;

    //相关推荐
    bool recommendDisable=17;

    //播放速度
    bool playbackSpeedDisable=18;

    //清晰度
    bool definitionDisable=19;

    //选集
    bool selectionsDisable=20;

    //下一集
    bool nextDisable=21;

    //编辑弹幕
    bool editDmDisable=22;

    //小窗
    bool smallWindowDisable=23;

    //震动
    bool shakeDisable=24;

    //
    bool outerDmDisable=25;

    //
    bool innerDmDisable=26;

    //
    bool freyaEnterDisable=27;

    //杜比音效
    bool dolbyDisable=28;
}

//播放控件稿件配置
message PlayArcConf {
	//后台播放
    ArcConf backgroundPlayConf=1;
    
    //镜像反转
    ArcConf flipConf=2;
    
    //投屏
    ArcConf castConf=3;
    
    //反馈
    ArcConf feedbackConf=4;
    
    //字幕
    ArcConf subtitleConf=5;
    
    //播放速度
    ArcConf playbackRateConf=6;
    
    //定时停止
    ArcConf timeUpConf=7;
    
    //播放方式
    ArcConf playbackModeConf=8;
    
    //画面尺寸
    ArcConf scaleModeConf=9;
    
    //赞
    ArcConf likeConf=10;
    
    //踩
    ArcConf dislikeConf=11;
    
    //投币
    ArcConf coinConf=12;
    
    //充电
    ArcConf elecConf=13;
    
    //分享
    ArcConf shareConf=14;
    
    //截图
    ArcConf screenShotConf=15;
    
    //锁定
    ArcConf lockScreenConf=16;
    
    //相关推荐
    ArcConf recommendConf=17;
    
    //播放速度
    ArcConf playbackSpeedConf=18;
    
    //清晰度
    ArcConf definitionConf=19;
    
    //选集
    ArcConf selectionsConf=20;
    
    //下一集
    ArcConf nextConf=21;
    
    //编辑弹幕
    ArcConf editDmConf=22;
    
    //小窗
    ArcConf smallWindowConf=23;
    
    //震动
    ArcConf shakeConf=24;
    
    //
    ArcConf outerDmConf=25;
    
    //
    ArcConf innerDmConf=26;
    
    //
    ArcConf freyaEnterConf=27;
    
    //杜比音效
    ArcConf dolbyConf=28;
}

//
message PlayConfState {
    //
    ConfType confType = 1;

    //
    bool show = 2;

    //
    FieldValue fieldValue = 3;
}

//
enum PlayErr {
    //
    NoErr_VALUE = 0;

    //
    WithMultiDeviceLoginErr_VALUE = 1;
}

//
message PlayerArgs {
    //
    int64 qn = 1;

    //
    int64 fnver = 2;

    //
    int64 fnval = 3;

    //
    int64 forceHost = 4;
}

//
message ResponseDash {
    //
    repeated DashItem video = 1;

    //
    repeated DashItem audio = 2;
}

//分段流条目
message ResponseUrl {
	//分段序号
	uint32 order = 1;
	
	//分段时长
	uint64 length = 2;
	
	//分段大小
	uint64 size = 3;
	
	//主线流
	string url = 4;
	
	//备用流
	repeated string backupUrl = 5;
	
	//md5
	string md5 = 6;
}

//分段视频流
message SegmentVideo {
	//分段视频流列表
	repeated ResponseUrl segment=1;
}

//震动
message Shake {
	//
	string file=1;
}

//视频流信息
message Stream {
	//元数据
    StreamInfo info=1;
    
    //
    oneof contentCase {
        //dash流
        DashVideo dashvideo=2;
        
        //分段流
        SegmentVideo segmentvideo=3;
    }
}

//流媒体元数据
message StreamInfo {
	//清晰度 qn
	uint32 quality=1;
	
	//格式
	string format=2;
	
	//格式描述
	string description=3;
	
	//错误码
	uint32 errCode=4;
	
	//不满足条件信息
	Limit limit=5;
	
	//是否需要vip
	bool needVip=6;
	
	//是否需要登录
	bool needLogin=7;
	
	//是否完整
	bool intact=8;
	
	//是否非全二压
	bool noRexcode=9;
	
	//
	int64 attribute=10;
	
	//新版格式描述
	string newDescription=11;
	
	//格式文字
	string displayDesc=12;
	
	//新版格式描述备注
	string superscript=13;
}

//不满足条件信息
message Limit {
	//
	string title=1;
	
	//
	string uri=2;
	
	//
	string msg=3;
}

//
message UpgradeButton {
    //
    string title = 1;

    //
    string link = 2;
}

//互动视频升级提示
message UpgradeLimit {
	//错误码
    int32 code =1;
    
    //错误信息
    string message =2;
    
    //图片url
    string image =3;
    
    //按钮信息
    UpgradeButton button=4;
}

//视频url信息
message VideoInfo {
	//视频清晰度
    uint32 quality=1;
    
    //视频格式
    string format=2;
    
    //视频时长
    uint64 timelength=3;
    
    //
    uint32 videoCodecid=4;
    
    //视频流
    repeated Stream streamList=5;
    
    //伴音流
    repeated DashItem audio=6;
    
    //杜比伴音流
    DolbyItem dolby=7;
}

//
enum VideoType {
    //
    Unknown_VALUE = 0;

    //
    FLV_VALUE = 1;

    //
    DASH_VALUE = 2;

    //
    MP4_VALUE = 3;
}