Skip to content

Commit 6f54f58

Browse files
committed
Commit changes targeted for 1.3.0 to new branch.
1 parent 797d919 commit 6f54f58

File tree

5 files changed

+4003
-2108
lines changed

5 files changed

+4003
-2108
lines changed

src/ableplayer.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
* License: MIT
1717
* License URI: https://github.com/ableplayer/ableplayer-wordpress/blob/master/LICENSE
1818
* Domain Path: lang
19-
* Version: 1.2.0
19+
* Version: 1.3.0-beta1
2020
*/
2121

2222
// Configure debugging mode.
2323
define( 'ABLEPLAYER_DEBUG', false );
2424

2525
// Get current version number.
26-
define( 'ABLEPLAYER_VERSION', '1.2.0' );
26+
define( 'ABLEPLAYER_VERSION', '1.3.0-beta1' );
2727

2828
register_activation_hook( __FILE__, 'ableplayer_activation' );
2929
/**
@@ -278,6 +278,10 @@ function able_player_parameters() {
278278
'description' => __( 'Set the default volume from 0 to 10; default is 7 to avoid overpowering screen reader audio)', 'ableplayer' ),
279279
'options' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10' ),
280280
),
281+
'sign-src' => array(
282+
'default' => '',
283+
'description' => __( 'Path to a local ASL video, synchronized with the main video.', 'ableplayer' ),
284+
),
281285
'youtube-id' => array(
282286
'default' => '',
283287
'description' => __( '11-character YouTube ID or a URL to a YouTube video page.', 'ableplayer' ),
@@ -345,6 +349,7 @@ function ableplayer_shortcode( $atts, $content = null ) {
345349
'seekinterval' => '',
346350
'nowplaying' => 'false',
347351
'skin' => '2020',
352+
'sign-src' => '',
348353
),
349354
$atts,
350355
'ableplayer'
@@ -422,6 +427,9 @@ function ableplayer_shortcode( $atts, $content = null ) {
422427
if ( ! empty( $all_atts['vimeo-desc-id'] ) ) {
423428
$o .= ' data-vimeo-desc-id="' . $all_atts['vimeo-desc-id'] . '"';
424429
}
430+
if ( ! empty( $all_atts['sign-src'] ) ) {
431+
$o .= ' data-sign-src="' . esc_url( $all_atts['sign-src'] ) . '"';
432+
}
425433
$o .= '>';
426434

427435
// enclosing tags.

src/build/ableplayer.4.4.1.js

Lines changed: 49 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5813,11 +5813,14 @@ if (thisObj.useTtml && (trackSrc.endsWith('.xml') || trackText.startsWith('<?xml
58135813
onError: function (x) {
58145814
deferred.fail();
58155815
},
5816-
onStateChange: function (x) {
5816+
onStateChange: function (x) {
58175817
thisObj.getPlayerState().then(function(playerState) {
58185818

58195819
// values of playerState: 'playing','paused','buffering','ended'
58205820
if (playerState === 'playing') {
5821+
if (thisObj.hasSignLanguage && thisObj.signVideo) {
5822+
thisObj.signVideo.play(true);
5823+
}
58215824
thisObj.playing = true;
58225825
thisObj.startedPlaying = true;
58235826
thisObj.paused = false;
@@ -5833,6 +5836,9 @@ if (thisObj.useTtml && (trackSrc.endsWith('.xml') || trackText.startsWith('<?xml
58335836
if (typeof thisObj.$posterImg !== 'undefined') {
58345837
thisObj.$posterImg.show();
58355838
}
5839+
if(thisObj.hasSignLanguage && thisObj.signVideo) {
5840+
thisObj.signVideo.pause(true);
5841+
}
58365842
thisObj.stoppingYouTube = false;
58375843
thisObj.seeking = false;
58385844
thisObj.playing = false;
@@ -8020,6 +8026,10 @@ if (thisObj.useTtml && (trackSrc.endsWith('.xml') || trackText.startsWith('<?xml
80208026

80218027
this.seeking = true;
80228028
this.liveUpdatePending = true;
8029+
if (this.hasSignLanguage && this.signVideo) {
8030+
// keep sign languge video in sync
8031+
this.signVideo.currentTime = this.startTime;
8032+
}
80238033
if (this.player === 'html5') {
80248034
var seekable;
80258035

@@ -8351,12 +8361,11 @@ if (thisObj.useTtml && (trackSrc.endsWith('.xml') || trackText.startsWith('<?xml
83518361
AblePlayer.prototype.pauseMedia = function () {
83528362

83538363
var thisObj = this;
8354-
8364+
if (this.hasSignLanguage && this.signVideo) {
8365+
this.signVideo.pause(true);
8366+
}
83558367
if (this.player === 'html5') {
83568368
this.media.pause(true);
8357-
if (this.hasSignLanguage && this.signVideo) {
8358-
this.signVideo.pause(true);
8359-
}
83608369
}
83618370
else if (this.player === 'youtube') {
83628371
this.youTubePlayer.pauseVideo();
@@ -8369,12 +8378,12 @@ if (thisObj.useTtml && (trackSrc.endsWith('.xml') || trackText.startsWith('<?xml
83698378
AblePlayer.prototype.playMedia = function () {
83708379

83718380
var thisObj = this;
8372-
8381+
if (this.hasSignLanguage && this.signVideo) {
8382+
this.signVideo.play(true);
8383+
}
83738384
if (this.player === 'html5') {
83748385
this.media.play(true);
8375-
if (this.hasSignLanguage && this.signVideo) {
8376-
this.signVideo.play(true);
8377-
}
8386+
83788387
}
83798388
else if (this.player === 'youtube') {
83808389
this.youTubePlayer.playVideo();
@@ -13454,7 +13463,11 @@ if (thisObj.useTtml && (trackSrc.endsWith('.xml') || trackText.startsWith('<?xml
1345413463

1345513464
(function ($) {
1345613465
AblePlayer.prototype.initSignLanguage = function() {
13457-
13466+
if (!this.isIOS() && this.$media.data('sign-src') !== undefined && this.$media.data('sign-src') !== "") {
13467+
this.hasSignLanguage = true;
13468+
this.injectSignPlayerCode();
13469+
return;
13470+
}
1345813471
// Sign language is only currently supported in HTML5 player, not YouTube or Vimeo
1345913472
if (this.player === 'html5') {
1346013473
// check to see if there's a sign language video accompanying this video
@@ -13503,22 +13516,46 @@ if (thisObj.useTtml && (trackSrc.endsWith('.xml') || trackText.startsWith('<?xml
1350313516
'tabindex' : '-1'
1350413517
});
1350513518
this.signVideo = this.$signVideo[0];
13506-
// for each original <source>, add a <source> to the sign <video>
13507-
for (i=0; i < this.$sources.length; i++) {
13519+
if(this.$media.data('sign-src'))
1350813520
signSrc = this.$sources[i].getAttribute('data-sign-src');
13521+
{
1350913522
srcType = this.$sources[i].getAttribute('type');
13523+
$signSource = $('<source>',{
1351013524
if (signSrc) {
13525+
'src' : this.$media.data('sign-src'),
1351113526
$signSource = $('<source>',{
13527+
'type' : 'video/' + this.$media.data('sign-src').substr(-3)
1351213528
'src' : signSrc,
13529+
});
1351313530
'type' : srcType
13531+
this.$signVideo.append($signSource);
1351413532
});
13533+
}
1351513534
this.$signVideo.append($signSource);
13535+
else {
1351613536
}
13537+
// for each original <source>, add a <source> to the sign <video>
1351713538
else {
13539+
for (i=0; i < this.$sources.length; i++) {
1351813540
// source is missing a sign language version
13541+
signSrc = this.$sources[i].getAttribute('data-sign-src');
1351913542
// can't include sign language
13543+
srcType = this.$sources[i].getAttribute('type');
1352013544
this.hasSignLanguage = false;
13545+
if (signSrc) {
1352113546
break;
13547+
$signSource = $('<source>',{
13548+
'src' : signSrc,
13549+
'type' : srcType
13550+
});
13551+
this.$signVideo.append($signSource);
13552+
}
13553+
else {
13554+
// source is missing a sign language version
13555+
// can't include sign language
13556+
this.hasSignLanguage = false;
13557+
return;
13558+
}
1352213559
}
1352313560
}
1352413561

0 commit comments

Comments
 (0)