| | |
| | | package com.yeshi.buwan.util.video; |
| | | |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.exception.video.VideoPlayException; |
| | | import com.yeshi.buwan.service.inter.video.VideoResourcePlayVersionMapService; |
| | | import com.yeshi.buwan.util.JuHe.VideoResourceUtil; |
| | | import com.yeshi.buwan.videos.acFun.AcFunUtil; |
| | | import com.yeshi.buwan.dao.VideoInfoDao; |
| | | import com.yeshi.buwan.domain.*; |
| | |
| | | @Resource |
| | | private VideoResourceService videoResourceService; |
| | | |
| | | @Resource |
| | | private VideoResourceUtil videoResourceUtil; |
| | | |
| | | |
| | | @Cacheable(value = "homeCache", key = "'getPlayUrl'+'-'+#detailSystemId+'-'+#id+'-'+#type+'-'+#resourceid") |
| | | public PlayUrl getPlayUrl(AcceptData acceptData, String detailSystemId, String id, String type, int resourceid, String videoid) { |
| | | public PlayUrl getPlayUrl(AcceptData acceptData, String detailSystemId, String id, String type, int resourceid, String videoid) throws VideoPlayException { |
| | | playLogger.info(VideoLogFactory.createPlayUrlLog(detailSystemId, id, type, resourceid, videoid)); |
| | | //判断resourceId是否在允许播放的来源列表中 |
| | | |
| | | List<Long> resourceIds = videoResourceUtil.getAvailablePlayResourceIds(new DetailSystem(detailSystemId), acceptData.getVersion(), acceptData.getChannel()); |
| | | if (resourceIds == null || !resourceIds.contains(Long.parseLong(resourceid + ""))) { |
| | | throw new VideoPlayException(1, "指定播放源无法播放"); |
| | | } |
| | | |
| | | |
| | | if (VideoUtil.getVideoFromType(id) == HomeVideo.FROM_TYPE_SHORT) { |
| | | VideoResource vr = videoResourceService.getResource(resourceid + ""); |
| | | return solrShortVideoDataManager.getPlayUrl(id, vr); |
| | |
| | | case HanmiUtil.RESOURCE_ID: |
| | | return hanmiService.getPlayUrl(detailSystemId, resourceid, id, videoid); |
| | | default: |
| | | return null; |
| | | throw new VideoPlayException(2, "未知播放源"); |
| | | } |
| | | } |
| | | |