View | Details | Raw Unified | Return to bug 20783
Collapse All | Expand All

(-)a/C4/HTML5Media.pm (-17 / +13 lines)
Lines 50-56 sub gethtml5media { Link Here
50
    my @HTML5MediaExtensions = split( /\|/, C4::Context->preference("HTML5MediaExtensions") );
50
    my @HTML5MediaExtensions = split( /\|/, C4::Context->preference("HTML5MediaExtensions") );
51
    my $HTML5MediaYouTube    = C4::Context->preference("HTML5MediaYouTube");
51
    my $HTML5MediaYouTube    = C4::Context->preference("HTML5MediaYouTube");
52
    my $marcflavour          = C4::Context->preference("marcflavour");
52
    my $marcflavour          = C4::Context->preference("marcflavour");
53
    my $isyoutube            = 0;
53
    my $is_embed            = 0;
54
    foreach my $HTML5Media_field (@HTML5Media_fields) {
54
    foreach my $HTML5Media_field (@HTML5Media_fields) {
55
        my %HTML5Media;
55
        my %HTML5Media;
56
        # protocol
56
        # protocol
Lines 99-117 sub gethtml5media { Link Here
99
        if ( $HTML5Media_field->subfield('u') ) {
99
        if ( $HTML5Media_field->subfield('u') ) {
100
            $HTML5Media{srcblock} = $HTML5Media_field->subfield('u');
100
            $HTML5Media{srcblock} = $HTML5Media_field->subfield('u');
101
            if (grep /youtu\.?be/, $HTML5Media_field->subfield('u') ) {
101
            if (grep /youtu\.?be/, $HTML5Media_field->subfield('u') ) {
102
                $HTML5Media{srcblock} = "";
102
                if ($HTML5MediaYouTube == 1) {
103
                if ($HTML5MediaYouTube == 1) {
103
                    require WWW::YouTube::Download;
104
                    use HTML::Video::Embed;
104
                    import  WWW::YouTube::Download qw(playback_url);
105
                    my $embedder = HTML::Video::Embed->new({
105
                    my $youtube           = WWW::YouTube::Download->new;
106
                        class   => 'html5-embed-video'
107
                    });
108
106
                    eval {
109
                    eval {
107
                        $HTML5Media{srcblock} = $youtube->playback_url(
110
                        my $html_embed_code = $embedder->url_to_embed( $HTML5Media_field->subfield('u') );
108
                            $HTML5Media_field->subfield('u'), {
111
                        $HTML5Media{embed} = $html_embed_code;
109
                                'fmt' => '43' #webm is the only format compatible to all modern browsers. maybe check for available qualities
110
                            }
111
                        );
112
                    };
112
                    };
113
                    if ($@) { warn $@; }
113
                    if ($@) { warn $@; }
114
                    else  { $isyoutube = 1;}
114
                    else  { $is_embed = 1;}
115
                }
115
                }
116
               else {
116
               else {
117
                   next; # do not embed youtube videos
117
                   next; # do not embed youtube videos
Lines 145-157 sub gethtml5media { Link Here
145
        else {
145
        else {
146
            $HTML5Media{extension} = ($HTML5Media{srcblock} =~ m/([^.]+)$/)[0];
146
            $HTML5Media{extension} = ($HTML5Media{srcblock} =~ m/([^.]+)$/)[0];
147
        }
147
        }
148
        if ( ( !grep /\Q$HTML5Media{extension}\E/, @HTML5MediaExtensions ) && ( $isyoutube != 1) ) {
148
        if ( ( !grep /\Q$HTML5Media{extension}\E/, @HTML5MediaExtensions ) && ( $is_embed != 1) ) {
149
            next; # not a specified media file
149
            next; # not a specified media file
150
        }
150
        }
151
        # youtube
152
        if ($isyoutube == 1) {
153
                $HTML5Media{mime} = 'video/webm';
154
        }
155
        # mime
151
        # mime
156
        if ( $HTML5Media_field->subfield('c') ) {
152
        if ( $HTML5Media_field->subfield('c') ) {
157
            $HTML5Media{codecs} = $HTML5Media_field->subfield('c');
153
            $HTML5Media{codecs} = $HTML5Media_field->subfield('c');
Lines 222-228 sub gethtml5media { Link Here
222
            $HTML5Media{type} = 'track';
218
            $HTML5Media{type} = 'track';
223
        }
219
        }
224
        # push
220
        # push
225
        if ( $HTML5Media{srcblock} && $HTML5Media{type} ) {
221
        if ( ($HTML5Media{srcblock} && $HTML5Media{type}) || $HTML5Media{embed} ) {
226
            push (@HTML5Media_sets, \%HTML5Media);
222
            push (@HTML5Media_sets, \%HTML5Media);
227
        }
223
        }
228
    }
224
    }
Lines 252-258 sub gethtml5media { Link Here
252
    }
248
    }
253
249
254
    return (
250
    return (
255
        HTML5MediaEnabled  => ( (scalar(@HTML5Media_sets) > 0) && ($HTML5MediaParent) ),
251
        HTML5MediaEnabled  => ( (scalar(@HTML5Media_sets) > 0 && $HTML5MediaParent) || $is_embed ),
256
        HTML5MediaSets     => \@HTML5Media_sets,
252
        HTML5MediaSets     => \@HTML5Media_sets,
257
        HTML5MediaParent   => $HTML5MediaParent,
253
        HTML5MediaParent   => $HTML5MediaParent,
258
        HTML5MediaWidth    => $HTML5MediaWidth,
254
        HTML5MediaWidth    => $HTML5MediaWidth,
(-)a/C4/Installer/PerlDependencies.pm (-3 / +3 lines)
Lines 782-791 our $PERL_DEPS = { Link Here
782
        'required' => '1',
782
        'required' => '1',
783
        'min_ver'  => '1.10',
783
        'min_ver'  => '1.10',
784
    },
784
    },
785
    'WWW::YouTube::Download' => {
785
    'HTML::Video::Embed' => {
786
        'usage'    => 'HTML5Media streaming from YouTube',
786
        'usage'    => 'Convert a url into a html embed string',
787
        'required' => '0',
787
        'required' => '0',
788
        'min_ver'  => '0.56',
788
        'min_ver'  => '0.016000',
789
    },
789
    },
790
    'Net::SFTP::Foreign' => {
790
    'Net::SFTP::Foreign' => {
791
        'usage'    => 'Edifact',
791
        'usage'    => 'Edifact',
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-4 / +8 lines)
Lines 828-837 Link Here
828
<div id="html5media">
828
<div id="html5media">
829
          [% FOREACH HTML5MediaSet IN HTML5MediaSets %]
829
          [% FOREACH HTML5MediaSet IN HTML5MediaSets %]
830
            <p>
830
            <p>
831
              <[% HTML5MediaParent | html %] controls preload=none>
831
                [% IF (HTML5MediaSet.embed) %]
832
                <[% HTML5MediaSet.child | html %] src="[% HTML5MediaSet.srcblock | html %]"[% HTML5MediaSet.typeblock | html %] />
832
                    [% HTML5MediaSet.embed | $raw %]
833
                [[% HTML5MediaParent | html %] tag not supported by your browser.]
833
                [% ELSE %]
834
              </[% HTML5MediaParent | html %]>
834
                    <[% HTML5MediaParent | html %] controls preload=none>
835
                        <[% HTML5MediaSet.child | html %] src="[% HTML5MediaSet.srcblock | html %]"[% HTML5MediaSet.typeblock | html %] />
836
                        [[% HTML5MediaParent | html %] tag not supported by your browser.]
837
                    </[% HTML5MediaParent | html %]>
838
                [% END %]
835
            </p>
839
            </p>
836
          [% END %]
840
          [% END %]
837
</div>
841
</div>
(-)a/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss (+9 lines)
Lines 3016-3019 button.closebtn { Link Here
3016
    }
3016
    }
3017
}
3017
}
3018
3018
3019
video {
3020
    width: 480px;
3021
}
3022
3023
.html5-embed-video {
3024
    width: 480px;
3025
    height: 300px;
3026
}
3027
3019
@import "responsive";
3028
@import "responsive";
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt (-6 / +9 lines)
Lines 1003-1013 Link Here
1003
                            <div id="html5media">
1003
                            <div id="html5media">
1004
                              [% FOREACH HTML5MediaSet IN HTML5MediaSets %]
1004
                              [% FOREACH HTML5MediaSet IN HTML5MediaSets %]
1005
                                <p>
1005
                                <p>
1006
                                  [% SET ctrl_preload = ' controls preload=none' #translatability %]
1006
                                    [% IF (HTML5MediaSet.embed) %]
1007
                                  <[% HTML5MediaParent _ ctrl_preload | html %] >
1007
                                        [% HTML5MediaSet.embed | $raw %]
1008
                                    <[% HTML5MediaSet.child | html %] src="[% HTML5MediaSet.srcblock | html %]"[% HTML5MediaSet.typeblock | html %] />
1008
                                    [% ELSE %]
1009
                                    <span>[[% HTML5MediaParent | html %] tag not supported by your browser.]</span>
1009
                                        [% SET ctrl_preload = ' controls preload=none' #translatability %]
1010
                                  </[% HTML5MediaParent | html %]>
1010
                                        <[% HTML5MediaParent _ ctrl_preload | html %] >
1011
                                        <[% HTML5MediaSet.child | html %] src="[% HTML5MediaSet.srcblock | html %]"[% HTML5MediaSet.typeblock | html %] />
1012
                                        <span>[[% HTML5MediaParent | html %] tag not supported by your browser.]</span>
1013
                                        </[% HTML5MediaParent | html %]>
1014
                                    [% END %]
1011
                                </p>
1015
                                </p>
1012
                              [% END %]
1016
                              [% END %]
1013
                            </div>
1017
                            </div>
1014
- 

Return to bug 20783