Пример #1
0
// video saved so clear sticky form
elgg_clear_sticky_form('video');
// handle results differently for new videos and video updates
if ($new_video) {
    if ($guid) {
        elgg_load_library('elgg:video');
        // Find out file info and save it as metadata
        $info = new VideoInfo($video);
        $video->resolution = $info->getResolution();
        $video->bitrate = $info->getBitrate();
        $video->duration = $info->getDuration();
        // Mark the video as unconverted so conversion script can find it
        $video->conversion_done = false;
        $video->save();
        $video->setSources();
        video_create_thumbnails($video);
        $message = elgg_echo("video:saved");
        system_message($message);
    } else {
        // failed to save video object - nothing we can do about this
        $error = elgg_echo("video:uploadfailed");
        register_error($error);
    }
    $container = get_entity($container_guid);
    if (elgg_instanceof($container, 'group')) {
        forward("video/group/{$container->guid}/all");
    } else {
        forward("video/owner/{$container->username}");
    }
} else {
    if ($guid) {
Пример #2
0
<?php

/**
 * Action for creating a new thumbnail for video
 *
 * @package Video
 */
$guid = get_input('guid');
$position = get_input('position');
$video = get_entity($guid);
if (!elgg_instanceof($video, 'object', 'video')) {
    register_error(elgg_echo('notfound'));
    forward();
}
if (!$position || !is_numeric($position)) {
    register_error(elgg_echo('video:error:invalid_position'));
    forward(REFERER);
}
elgg_load_library('elgg:video');
if (video_create_thumbnails($video, $position)) {
    forward($video->getURL());
    system_message(elgg_echo('video:thumbnail:success'));
} else {
    forward(REFERER);
    register_error(elgg_echo('video:error:thumbnail_creation_failed'));
}