Remove product literal strings in "pht()", part 5
[phabricator.git] / src / applications / files / document / PhabricatorVideoDocumentEngine.php
blob4e03c62ebcd3082593cb9521a066eaebc4244a24
1 <?php
3 final class PhabricatorVideoDocumentEngine
4 extends PhabricatorDocumentEngine {
6 const ENGINEKEY = 'video';
8 public function getViewAsLabel(PhabricatorDocumentRef $ref) {
9 return pht('View as Video');
12 protected function getContentScore(PhabricatorDocumentRef $ref) {
13 // Some video documents can be rendered as either video or audio, but we
14 // want to prefer video.
15 return 2500;
18 protected function getByteLengthLimit() {
19 return null;
22 protected function getDocumentIconIcon(PhabricatorDocumentRef $ref) {
23 return 'fa-film';
26 protected function canRenderDocumentType(PhabricatorDocumentRef $ref) {
27 $file = $ref->getFile();
28 if ($file) {
29 return $file->isVideo();
32 $viewable_types = PhabricatorEnv::getEnvConfig('files.viewable-mime-types');
33 $viewable_types = array_keys($viewable_types);
35 $video_types = PhabricatorEnv::getEnvConfig('files.video-mime-types');
36 $video_types = array_keys($video_types);
38 return
39 $ref->hasAnyMimeType($viewable_types) &&
40 $ref->hasAnyMimeType($video_types);
43 protected function newDocumentContent(PhabricatorDocumentRef $ref) {
44 $file = $ref->getFile();
45 if ($file) {
46 $source_uri = $file->getViewURI();
47 } else {
48 throw new PhutilMethodNotImplementedException();
51 $mime_type = $ref->getMimeType();
53 $video = phutil_tag(
54 'video',
55 array(
56 'controls' => 'controls',
58 phutil_tag(
59 'source',
60 array(
61 'src' => $source_uri,
62 'type' => $mime_type,
63 )));
65 $container = phutil_tag(
66 'div',
67 array(
68 'class' => 'document-engine-video',
70 $video);
72 return $container;