返回封面
This commit is contained in:
		@@ -15,10 +15,9 @@ import (
 | 
			
		||||
	"github.com/spf13/viper"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func GetVideoM3U8(content string) (playinfo *vod20170321.GetPlayInfoResponseBodyPlayInfoList, err error) {
 | 
			
		||||
func GetVideoM3U8(content string) (playinfo *vod20170321.GetPlayInfoResponseBody, err error) {
 | 
			
		||||
	if len(regexp.MustCompile(`image.gameuiux.cn`).FindStringSubmatch(content)) > 0 {
 | 
			
		||||
		key := regexp.MustCompile(`^https?://image.gameuiux.cn/`).ReplaceAllString(content, "")
 | 
			
		||||
		log.Println("GetVideoM3U8", key)
 | 
			
		||||
		// 连接点播服务的OSS
 | 
			
		||||
		client, _err := vod20170321.NewClient(&openapi.Config{
 | 
			
		||||
			AccessKeyId:     tea.String(viper.GetString("video.accessID")),
 | 
			
		||||
@@ -43,7 +42,7 @@ func GetVideoM3U8(content string) (playinfo *vod20170321.GetPlayInfoResponseBody
 | 
			
		||||
				return nil, _err
 | 
			
		||||
			}
 | 
			
		||||
			// 返回播放地址列表
 | 
			
		||||
			return result.Body.PlayInfoList, nil
 | 
			
		||||
			return result.Body, nil
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		log.Println("无结果, 从OSS加载视频")
 | 
			
		||||
@@ -98,8 +97,6 @@ func GetVideoM3U8(content string) (playinfo *vod20170321.GetPlayInfoResponseBody
 | 
			
		||||
				return nil, errors.New("转码超时")
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// fmt.Println("UploadAuth", *createUploadVideoResponse.Body.UploadAuth)
 | 
			
		||||
		// 4.媒体上传完成之后,可以获取媒体播放信息进行播放
 | 
			
		||||
		// 4.1 通过播放凭证播放
 | 
			
		||||
		getPlayInfoReponse, _err := client.GetPlayInfo(&vod20170321.GetPlayInfoRequest{
 | 
			
		||||
@@ -110,18 +107,7 @@ func GetVideoM3U8(content string) (playinfo *vod20170321.GetPlayInfoResponseBody
 | 
			
		||||
			return nil, _err
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		fmt.Println("GetPlayInfo", getPlayInfoReponse.Body.PlayInfoList)
 | 
			
		||||
		return getPlayInfoReponse.Body.PlayInfoList, nil
 | 
			
		||||
 | 
			
		||||
		//// 4.2 通过播放地址播放
 | 
			
		||||
		//getVideoPlayAuthRequest := &vod20170321.GetVideoPlayAuthRequest{
 | 
			
		||||
		//	VideoId: uploadVideoId,
 | 
			
		||||
		//}
 | 
			
		||||
		//getVideoPlayAuthReponse, _err := client.GetVideoPlayAuth(getVideoPlayAuthRequest)
 | 
			
		||||
		//if _err != nil {
 | 
			
		||||
		//	return _err
 | 
			
		||||
		//}
 | 
			
		||||
		//console.Log(util.ToJSONString(tea.ToMap(getVideoPlayAuthReponse)))
 | 
			
		||||
		return getPlayInfoReponse.Body, nil
 | 
			
		||||
	}
 | 
			
		||||
	return nil, errors.New("无效的视频地址")
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user