WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: JW Player Plugin for WordPress] JW player subtitles (1 post)

  1. Fab1en
    Member
    Posted 2 years ago #

    Hi all
    I would like to suggest to LongTail video to add a feature in the WP jwplayer plugin to enable different subtitles for each video. Today, if I did not miss something, it's only possible to specify the video subtitles in the global jwplayer settings page, using the captions plugin. It could be great to specify the subtitles for each video, in exactly the same way that we can specify a thumbnail.

    Here is the code I use to do this:
    in media/JWMediaFunctions.php

    function jwplayer_attachment_fields_to_save($post, $attachment) {
    [...]
      if ($mime_type == "video"){
        update_post_meta($post["ID"], LONGTAIL_KEY . "captions", $attachment[LONGTAIL_KEY . "captions"]);
      }
    }
    [...]
    function jwplayer_attachment_fields($form_fields, $post) {
        [...]
        $form_fields[LONGTAIL_KEY . 'captions'] = array(
            "label" => __("Captions"),
            "input" => "text",
            "value" => get_post_meta($post->ID, LONGTAIL_KEY . "captions", true)
          );
    }

    and finally in framework/JWEmbedderConfig.php

    public function generateEmbedScript() {
        global $post;
        [...]
        $attachement_ID = get_post_meta($post->ID, LONGTAIL_KEY . "fb_headers_id", true);
        $captions = get_post_meta($attachement_ID, LONGTAIL_KEY . "captions", true);
        $script .= "'captions.files': \"$captions\", ";
    }

    The same code could be repeated to also insert a HD version when the HD plugin is used.
    That could be great if this enhancement would be available in the next JW Player plugin release !
    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags