/** * Function CHECK_VID * 检查vid是否可用 */ public function check_vid() { $vid = $_GET['vid']; $r = $this->db->get_one(array('vid' => $vid)); if (is_array($r)) { $data = player_code('video_player', $r['channelid'], $r['vid'], 300, 225); exit($data); } else { exit(1); } $url = pc_base::load_config('ku6server', 'player_url') . $vid . '/style/' . $this->setting['style_projectid'] . '/'; $data = @file_get_contents($url); if ($data = json_decode($data, true)) { if ($data['code'] < 0) { exit($data['msg']); } else { exit('1'); } } else { exit('1'); } }
public function get_player_code() { $id = $this->input['id']; if (!$id) { $this->errorOutput('无效视频id'); } $diy_data = array(); if ($this->input['diy']) { $diy_data = json_decode($this->input['diy'], 1); } //获取播放器参数 $curl = new curl($this->settings['App_auth']['host'], $this->settings['App_auth']['dir'] . 'admin/'); $curl->initPostData(); $data = array('flag' => 'player', 'admin_id' => $this->user['user_id']); foreach ($data as $k => $v) { $curl->addRequestData($k, $v); } $paramters = $curl->request('preferences.php'); $all_player = array(); if (!$paramters || $paramters['ErrorCode'] || $paramters['ErrorText']) { $paramters = array('width' => $diy_data['width'] ? $diy_data['width'] : 640, 'height' => $diy_data['height'] ? $diy_data['height'] : 480, 'auto_play' => $diy_data['auto_play'] ? $diy_data['auto_play'] : 0, 'config_xml' => $this->settings['player']['config_xml']); } else { $default_player = array(); $all_player = $paramters; foreach ($paramters as $val) { if ($val['status'] == 1) { $default_player = $val; } if ($diy_data && $val['id'] == $diy_data['player_id']) { $default_player = $val; break; } } if (!$default_player) { $default_player = $paramters[0]; } $default_config_xml = $this->settings['player']['config_xml_prefix'] . $this->user['user_id'] . '_' . $default_player['id'] . 'vod.xml'; $paramters = $default_player['admin_settings']; $paramters = array('width' => $diy_data['width'] ? $diy_data['width'] : $paramters['player_width'], 'height' => $diy_data['height'] ? $diy_data['height'] : $paramters['player_height'], 'auto_play' => isset($diy_data['auto_play']) ? $diy_data['auto_play'] : $paramters['auto_play'], 'config_xml' => $default_config_xml); } $player_code = player_code($id, $paramters); $player_code['player'] = $all_player; //追加所有播放器用于选择 if (!$diy_data) { //只有首次加载返回二维码 $qrcode = $this->get_qrcode(array('content' => $player_code['url'])); $player_code['qrcode'] = is_array($qrcode) ? hg_fetchimgurl($qrcode) : ''; } if ($player_code) { $this->addItem($player_code); $this->output(); } }
<?php defined('IN_ADMIN') or exit('No permission resources.'); include $this->admin_tpl('header', 'admin'); echo player_code('video_player', $r['channelid'], $r['vid'], 450, 350);