Bugzilla – Attachment 55093 Details for
Bug 17231
HTML5MediaYouTube should recognize youtu.be links from youtube as well at the full links
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17231 - HTML5MediaYouTube should recognize youtu.be links from youtube as well at the full links
Bug-17231---HTML5MediaYouTube-should-recognize-you.patch (text/plain), 2.49 KB, created by
Claire Gravely
on 2016-09-01 14:56:05 UTC
(
hide
)
Description:
Bug 17231 - HTML5MediaYouTube should recognize youtu.be links from youtube as well at the full links
Filename:
MIME Type:
Creator:
Claire Gravely
Created:
2016-09-01 14:56:05 UTC
Size:
2.49 KB
patch
obsolete
>From 54d63c0a951071902570f468456f1ad605c38beb Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 31 Aug 2016 17:37:56 +0000 >Subject: [PATCH] Bug 17231 - HTML5MediaYouTube should recognize youtu.be links > from youtube as well at the full links > >To test: >Enable HTML5MediaYouTube and ensure WWW::YouTube::Download is installed >Add an 856$u to a record like: https://www.youtube.com/watch?v=tu0qtEwb9gE >Verify you can see the embedded player >Use the youtube shortened like (from the share button) like: >https://youtu.be/tu0qtEwb9gE >Verify you can see the embedded player > >Signed-off-by: Claire Gravely <claire_gravely@hotmail.com> >--- > C4/HTML5Media.pm | 18 ++++++++++-------- > 1 file changed, 10 insertions(+), 8 deletions(-) > >diff --git a/C4/HTML5Media.pm b/C4/HTML5Media.pm >index b438933..462f6b4 100644 >--- a/C4/HTML5Media.pm >+++ b/C4/HTML5Media.pm >@@ -98,18 +98,20 @@ sub gethtml5media { > # src > if ( $HTML5Media_field->subfield('u') ) { > $HTML5Media{srcblock} = $HTML5Media_field->subfield('u'); >- if (grep /youtube/, $HTML5Media_field->subfield('u') ) { # TODO is there an official YT URL shortener? Can we use that too? >+ if (grep /youtube|youtu[.]be/, $HTML5Media_field->subfield('u') ) { > if ($HTML5MediaYouTube == 1) { > require WWW::YouTube::Download; > import WWW::YouTube::Download qw(playback_url); > my $youtube = WWW::YouTube::Download->new; >- $HTML5Media{srcblock} = $youtube->playback_url( >- $HTML5Media_field->subfield('u'), { >- 'fmt' => '43' #webm is the only format compatible to all modern browsers. maybe check for available qualities >- } >- ); >- # TODO handle error if format not available. Does that ever occur? >- $isyoutube = 1; >+ eval { >+ $HTML5Media{srcblock} = $youtube->playback_url( >+ $HTML5Media_field->subfield('u'), { >+ 'fmt' => '43' #webm is the only format compatible to all modern browsers. maybe check for available qualities >+ } >+ ); >+ }; >+ if ($@) { warn $@; } >+ else { $isyoutube = 1;} > } > else { > next; # do not embed youtube videos >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17231
:
55076
|
55091
|
55093
|
55298
|
55324
|
55325