/** * 添加一个lesson * @param unknown_type $lesson */ public function addLesson($lesson) { $owner = $this->getOwner(); $lesson->userId = Yii::app()->user->id; $lesson->courseId = $owner->id; $lesson->addTime = time(); //处理外链类型的视频 if ($lesson->mediaSource && $lesson->mediaSource != "self" && $lesson->mediaSource != "cloud" && $lesson->mediaType != "text") { if (strpos($lesson->mediaUri, 'http://') !== 0) { $lesson->mediaUri = 'http://' . $lesson->mediaUri; } if (strpos($lesson->mediaUri, '.swf') === false) { Yii::import('ext.videolink.VideoLink'); $video = new VideoLink(); $result = $video->parse($lesson->mediaUri); if ($result) { $lesson->mediaUri = $result['swf']; $lesson->mediaSource = $result['source']; $lesson->mediaName = $result['title']; $lesson->mediaType = "video"; } } } if (!$lesson->title) { $lesson->title = $lesson->mediaName; } $lesson->status = Lesson::STATUS_HIDDEN; return $lesson->save(); }
public function beforeSave() { if (!DxdUtil::startWith($this->url, 'http://') && !DxdUtil::startWith($this->url, 'https://')) { $this->url = 'http://' . $this->url; } if (strpos($this->url, '.swf') === false) { Yii::import('ext.videolink.VideoLink'); $video = new VideoLink(); $result = @$video->parse($this->url); if ($result) { $this->url = $result['swf']; $this->source = $result['source']; $this->title = $result['title']; } } return parent::beforeSave(); }
?> " width="100%" height="600px" type="application/x-shockwave-flash" allowscriptaccess="always" quality="high" allowfullscreen="true" runat="server" /> <?php } else { ?> <?php Yii::import('ext.videolink.VideoLink'); $videoLink = new VideoLink(); $video = $videoLink->parse($lesson->mediaUri); $vid = $video['vid']; ?> <embed id="MukioPlayer" src="<?php echo Yii::app()->baseUrl . "/"; ?> mukioplayerplus.swf?type=youku&vid=<?php echo $vid; ?> " width="100%" height="600px" type="application/x-shockwave-flash" allowscriptaccess="always" quality="high"