コード例 #1
0
    /**
     * Runs the widget
     */
    public function run()
    {
        echo CHtml::openTag('div', array('class' => 'media-flags'));
        // Some media don't have any stream details, we have to skip the flags
        // that depend on them.
        $helper = new MediaInfoHelper($this->file);
        if ($helper->hasMediaInfo()) {
            $streamDetails = $this->file->streamdetails;
            ?>
			<div class="flag-section">
				<?php 
            $this->widget('MediaFlagResolution', array('streamDetails' => $streamDetails));
            $this->widget('MediaFlagVideoCodec', array('streamDetails' => $streamDetails));
            ?>
			</div>
			
			<div class="flag-section">
				<?php 
            $this->widget('MediaFlagAudioCodec', array('streamDetails' => $streamDetails));
            $this->widget('MediaFlagAudioChannels', array('streamDetails' => $streamDetails));
            ?>
			</div>
			
			<div class="flag-section">
				<?php 
            $this->widget('MediaFlagAspect', array('streamDetails' => $streamDetails));
            ?>
			</div>
			<?php 
        }
        ?>
		<div class="flag-section">
			<?php 
        $this->widget('MediaFlagVideoSource', array('file' => $this->file->file));
        $this->widget('MediaFlagAudioSource', array('file' => $this->file->file));
        ?>
		</div>
		<?php 
        echo CHtml::closeTag('div');
    }
コード例 #2
0
    /**
     * Renders the form that contains the buttons and links to watch/download 
     * and item
     */
    private function renderForm()
    {
        // Render the form with all the retrieval options
        echo CHtml::beginForm($this->getPlayListAction(), 'get');
        echo CHtml::hiddenField('id', $this->details->getId());
        // Show the "Play in browser" button when applicable
        $helper = new MediaInfoHelper($this->details);
        if (!$helper->needsTranscoding() && count($this->_links) === 1) {
            ?>
			<section>
				<?php 
            $this->renderWatchInBrowserButton();
            ?>
			</section>
			<?php 
        }
        // Show the "Watch as playlist" button if the file is streamable,
        // otherwise show an alert
        if ($helper->isStreamable()) {
            ?>
			<section>
				<?php 
            $this->renderWatchButton();
            ?>
			</section>
			<?php 
        } else {
            $this->renderMissingFile();
        }
        // Render the download links and close the form
        $this->renderLinks();
        echo CHtml::endForm();
    }
コード例 #3
0
    /**
     * Renders the form that contains the buttons and links to watch/download 
     * and item
     */
    private function renderForm()
    {
        // Render the form with all the retrieval options
        echo CHtml::beginForm($this->getPlayListAction(), 'get');
        echo CHtml::hiddenField('id', $this->details->getId());
        // Show the "Play in XBMC" button to administrators
        if (Yii::app()->user->role === User::ROLE_ADMIN) {
            ?>
			<section>
				<?php 
            $this->renderPlayOnBackendButton();
            ?>
			</section>
			<?php 
        }
        // Show the "Play in browser" button when applicable
        $helper = new MediaInfoHelper($this->details);
        if (!$helper->needsTranscoding() && count($this->_links) === 1) {
            ?>
			<section>
				<?php 
            $this->renderWatchInBrowserButton();
            ?>
			</section>
			<?php 
        }
        ?>
		<section>
			<?php 
        $this->renderWatchButton();
        ?>
		</section>
		<?php 
        // Render the download links and close the form
        $this->renderLinks();
        echo CHtml::endForm();
    }
コード例 #4
0
 /**
  * Plays the specified URL in the in-browser player
  * @param string $url the URL to the media
  */
 public function actionWatchInBrowser($url)
 {
     // Create a tuple containing the URL and the MIME type of the file
     $item = new stdClass();
     $item->url = $url;
     $item->mimeType = MediaInfoHelper::getMIMEType($url);
     $this->render('//videoLibrary/browserPlayer', array('items' => array($item)));
 }