PageSourceSearch

https://www.wrzk.com/wp-content/plugins/wpb-show-core/modules/jpla….android-adapter-fix.js?v=11202017c&ver=2.3

js wrzk.com collected 2026-09-29 12:51:16 UTC 3,162 bytes, 113 lines download raw bytes

1// TMP For testing on standard browsers.
2// $.jPlayer.platform.android = true;
3
4var jPlayerAndroidFix = (function($) {
5	var fix = function(id, media, options) {
6		this.playFix = false;
7		this.init(id, media, options);
8	};
9	fix.prototype = {
10		init: function(player, media, options) {
11			var self = this;
12
13			// Store the params
14			this.media = media;
15			this.options = options;
16
17			// Make a jQuery selector of the id, for use by the jPlayer instance.
18			this.player = player;
19
20			// Make the ready event to set the media to initiate.
21			this.player.bind($.jPlayer.event.ready, function(event) {
22				// Use this fix's setMedia() method.
23				self.setMedia(self.media);
24			});
25
26			// Apply Android fixes
27			if($.jPlayer.platform.android) {
28
29				// Fix playing new media immediately after setMedia.
30				this.player.bind($.jPlayer.event.progress, function(event) {
31					if(self.playFixRequired) {
32						self.playFixRequired = false;
33
34						// Enable the contols again
35						// self.player.jPlayer('option', 'cssSelectorAncestor', self.cssSelectorAncestor);
36
37						// Play if required, otherwise it will wait for the normal GUI input.
38						if(self.playFix) {
39							self.playFix = false;
40							$(this).jPlayer("play");
41						}
42					}
43				});
44				// Fix missing ended events.
45				this.player.bind($.jPlayer.event.ended, function(event) {
46					if(self.endedFix) {
47						self.endedFix = false;
48						setTimeout(function() {
49							self.setMedia(self.media);
50						},0);
51						// what if it was looping?
52					}
53				});
54				this.player.bind($.jPlayer.event.pause, function(event) {
55					if(self.endedFix) {
56						var remaining = event.jPlayer.status.duration - event.jPlayer.status.currentTime;
57						if(event.jPlayer.status.currentTime === 0 || remaining < 1) {
58							// Trigger the ended event from inside jplayer instance.
59							setTimeout(function() {
60								self.jPlayer._trigger($.jPlayer.event.ended);
61							},0);
62						}
63					}
64				});
65			}
66
67			// Instance jPlayer
68			this.player.jPlayer(this.options);
69
70			// Store a local copy of the jPlayer instance's object
71			this.jPlayer = this.player.data('jPlayer');
72
73			// Store the real cssSelectorAncestor being used.
74			this.cssSelectorAncestor = this.player.jPlayer('option', 'cssSelectorAncestor');
75
76			// Apply Android fixes
77			this.resetAndroid();
78
79			return this;
80		},
81		setMedia: function(media) {
82			this.media = media;
83
84			// Apply Android fixes
85			this.resetAndroid();
86
87			// Set the media
88			this.player.jPlayer("setMedia", this.media);
89			return this;
90		},
91		play: function() {
92			// Apply Android fixes
93			if($.jPlayer.platform.android && this.playFixRequired) {
94				// Apply Android play fix, if it is required.
95				this.playFix = true;
96			} else {
97				// Other browsers play it, as does Android if the fix is no longer required.
98				this.player.jPlayer("play");
99			}
100		},
101		resetAndroid: function() {
102			// Apply Android fixes
103			if($.jPlayer.platform.android) {
104				this.playFix = false;
105				this.playFixRequired = true;
106				this.endedFix = true;
107				// Disable the controls
108				// this.player.jPlayer('option', 'cssSelectorAncestor', '#NeverFoundDisabled');
109			}
110		}
111	};
112	return fix;
113})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.