起了一个H5的作业,这里抄抄哪里抄抄,不知道为什么安卓手机无法播放音频,所有设备都可以,就安卓H5不行,不知道有大哥指点修改下不, T。T
webpackJsonp([4], {
465 : function(e, t, a) {
"use strict";
function i(e) {
return e && e.__esModule ? e: {
default:
e
}
}
function s(e) {
var t = e.homeIndex_1,
a = t.daily,
i = t.catalog,
s = e.playIndex,
n = s.courseList,
c = s.mediaAuth,
o = s.order,
r = s.collection,
l = e.coupons;
return {
_daily: a,
_catalog: i,
_courseList: n,
_mediaAuth: c,
_order: o,
_collection: r,
_coupons: l.coupons,
_couponsList: l.couponsList,
_supplyerInfo: e.success.supplyerInfo
}
}
function n(e) {
return {
ACTIONS: (0, v.bindActionCreators)(I.
default, e)
}
}
Object.defineProperty(t, "__esModule", {
value: !0
});
var c = a(57),
o = i(c),
r = a(53),
l = i(r),
u = a(54),
d = i(u),
p = a(55),
f = i(p),
h = a(56),
y = i(h),
m = a(3),
g = i(m),
v = a(75),
b = a(196),
k = a(119),
_ = i(k);
a(485);
var N = a(491),
E = i(N),
C = a(484),
I = i(C),
P = a(195);
a(539);
var S = function(e) {
function t(e) { (0, l.
default)(this, t);
var a = (0, f.
default)(this, (t.__proto__ || (0, o.
default)(t)).call(this, e));
return a.state = {
isActive: "introduction",
isCollected: "",
cid: "",
playerImg: !0,
player: !1,
playerVideo: "",
isBuy: a.props._daily.isBuy,
currentPlay: null,
currentPlayName: a.props._daily.pName,
type: "",
isStick: !1,
coupons: null,
desc: "",
currentCouponId: null,
payAlert: !!sessionStorage.getItem("showPayAlert"),
showPayAlert: sessionStorage.getItem("showPayAlert"),
playerImgUrl: "",
actived: "CN",
checks: "CN",
content: "",
media: "audio"
},
a.player = a.player.bind(a),
a.getInit = a.getInit.bind(a),
a.format = a.format.bind(a),
a.hidePay = a.hidePay.bind(a),
a.showPay = a.showPay.bind(a),
a.goToPage = a.goToPage.bind(a),
a.playerOther = a.playerOther.bind(a),
a.getIsPlay = a.getIsPlay.bind(a),
a.getClassName = a.getClassName.bind(a),
a.back = a.back.bind(a),
a.isAndroid = a.isAndroid.bind(a),
a.checkSwitch = a.checkSwitch.bind(a),
a
}
return (0, y.
default)(t, e),
(0, d.
default)(t, [{
key: "componentDidMount",
value: function() {
this.getInit(),
document.documentElement.scrollTop = document.body.scrollTop = 0
}
},
{
key: "activedItem",
value: function(e) {
this.state.isActive !== e && this.setState({
isActive: e
})
}
},
{
key: "format",
value: function(e, t) {
return E.
default.date(e, t)
}
},
{
key: "getInit",
value: function() {
var e = this,
t = this.props.params.id,
a = this.props,
i = a.ACTIONS;
a._catalog,
a._daily;
if ("jq" == t) return void i.catalog(function() {
e.checkSwitch("CN")
});
this.props.ACTIONS.selectById({
id: t
},
function() {
e.checkSwitch("CN")
})
}
},
{
key: "playerOther",
value: function(e) {
if (!e) return _.
default.info("该音频不存在"),
!1;
this.player(e)
}
},
{
key: "player",
value: function(e) {
if (e) return this.playerVideo ? void this.playerVideo.loadByUrl(e) : void 0
}
},
{
key: "goToPage",
value: function(e) {
this.props.history.push(e)
}
},
{
key: "showPay",
value: function() {
this.setState({
payAlert: !0
})
}
},
{
key: "hidePay",
value: function() {
this.setState({
payAlert: !1,
showPayAlert: !1
})
}
},
{
key: "getIsPlay",
value: function(e, t) {
this.setState({
actived: e,
media: 0 == t ? "audio": "video"
});
for (var a = this.props._daily,
i = a.audioList || [], s = a.videoList || [], n = null, c = null, o = 0; o < i.length; o++) if (i[o].identifier == e) {
n = i[o].url;
break
}
for (var o = 0; o < s.length; o++) if (s[o].identifier == e) {
c = s[o].url;
break
}
return 0 == t ? (this.refs.video_1.src = "", this.refs.video_2.controls = "", this.refs.audio_1.style.display = "block", this.refs.audio_1.src = n, this.refs.audio_2.load(), this.refs.video_2.pause()) : (this.refs.video_2.style.display = "block", this.refs.audio_1.style.display = "none", this.refs.video_2.controls = "controls", this.refs.video_1.src = c || "http://cdn1.gepengze.com/c35c7d42cb0f4ddda10cc8fe005c6ceb/0af12101f14b46328eba2a033a2bba48-0261581888ead32222522f1140fe5723-ld.mp4", this.refs.video_2.load(), this.refs.audio_2.pause()),
this.autoLoading(),
!0
}
},
{
key: "test_1",
value: function() {}
},
{
key: "autoLoading",
value: function() { (0, P.Loading)(!0),
setTimeout(function() { (0, P.Loading)(!1)
},
1500)
}
},
{
key: "getClassName",
value: function(e) {
return this.state.media == e ? "actived": ""
}
},
{
key: "back",
value: function() {
this.props.history.push("index")
}
},
{
key: "isAndroid",
value: function() {
return navigator.userAgent.toLowerCase().indexOf("android")
}
},
{
key: "checkSwitch",
value: function(e) {
var t = /\>[\u4e00-\u9fa5]+((?!<).)+\</g,
a = /\>[0-9]+\.?[0-9]*\</g,
i = /\>[,。?:;‘’!“”—……、,]|(-{2})|(())|(【】)|({})|(《》)\</g,
s = /\>[a-zA-Z]+((?!<).)+\</g,
n = this.props._daily,
c = n.content || "";
switch (e) {
case "EN":
c = c.replace(t, "").replace(a, "").replace(i, "");
break;
case "CN":
c = c.replace(s, "")
}
this.setState({
checks: e,
content: c
})
}
},
{
key: "render",
value: function() {
var e = this,
t = this.props._daily;
return g.
default.createElement("div", {
className: "container"
},
g.
default.createElement("div", {
className: "top-container"
},
g.
default.createElement("div", {
className: "back",
onClick: this.back.bind(this)
}), g.
default.createElement("img", {
className: "top-pic",
src: a(540),
alt: ""
}), g.
default.createElement("div", {
className: "top-title"
},
g.
default.createElement("span", {
className: "circle-1"
}), g.
default.createElement("span", {
className: "circle-2"
}), g.
default.createElement("span", {
className: "title"
},
t.title), g.
default.createElement("span", {
className: "circle-2"
}), g.
default.createElement("span", {
className: "circle-1"
})), g.
default.createElement("div", {
className: "checkswitch"
},
g.
default.createElement("button", {
className: "CN" == this.state.checks ? "zws checks": "zws",
onClick: function() {
e.checkSwitch("CN")
}
},
"中"), g.
default.createElement("button", {
className: "EN" == this.state.checks ? "ens checks": "ens",
onClick: function() {
e.checkSwitch("EN")
}
},
"En"))), g.
default.createElement("div", {
className: "pic-container"
},
g.
default.createElement("div", {
className: "pic-content"
},
g.
default.createElement("div", {
key: "ddd",
className: "yp play-container prism-player",
id: "J_prismPlayer"
},
g.
default.createElement("video", {
ref: "video_2",
poster: t.picList && t.picList.length <= 1 ? t.picList[0].quality: t.picList && t.picList.length > 1 ? t.picList[1].quality: a(494),
autoPlay: "autoPlay",
preload: !0
},
g.
default.createElement("source", {
ref: "video_1",
src: "",
type: "video/mp4"
}), g.
default.createElement("img", {
className: this.isAndroid() > 0 ? "android show imgTop detail-pic": "show imgTop detail-pic",
src: t.picList && t.picList.length <= 1 ? t.picList[0].quality: t.picList && t.picList.length > 1 ? t.picList[1].quality: a(494)
}))), g.
default.createElement("audio", {
ref: "audio_2",
canPlay: this.test_1,
playing: this.test_1,
progress: this.test_1,
oadstart: this.test_1,
autoPlay: "true",
controls: "",
loop: "",
style: {
display: "none"
}
},
g.
default.createElement("source", {
src: "",
type: "audio/mpeg",
ref: "audio_1"
})), g.
default.createElement("div", {
className: "voice-text"
},
g.
default.createElement("span", {
className: this.getClassName("audio") + " voice-c",
onClick: function() {
e.getIsPlay(e.state.checks, 0)
}
},
"CN" == this.state.checks ? "语音介绍": "voice introduction"), g.
default.createElement("span", {
className: this.getClassName("video") + " voice-e",
onClick: function() {
e.getIsPlay(e.state.checks, 1)
}
},
"CN" == this.state.checks ? "视频介绍": "vedio introduction")))), g.
default.createElement("div", {
className: "detail-text",
dangerouslySetInnerHTML: {
__html: this.state.content || t.content
}
}))
}
}]),
t
} (m.Component);
t.
default = (0, b.connect)(s, n)(S),
e.exports = t.
default
},
491 : function(e, t, a) {
"use strict";
var i = a(120),
s = a(198),
n = function(e) {
return e && e.__esModule ? e: {
default:
e
}
} (s),
c = {
date: function(e, t) {
if (!e || !t) return e;
8 == e.length && (e = e.substr(0, 4) + "-" + e.substr(4, 2) + "-" + e.substr(6, 2));
var a = {
"M+": e.getMonth() + 1,
"d+": e.getDate(),
"h+": e.getHours(),
"m+": e.getMinutes(),
"s+": e.getSeconds(),
"q+": Math.floor((e.getMonth() + 3) / 3),
S: e.getMilliseconds()
};
/(y+)/.test(t) && (t = t.replace(RegExp.$1, (e.getFullYear() + "").substr(4 - RegExp.$1.length)));
for (var i in a) new RegExp("(" + i + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? a[i] : ("00" + a[i]).substr(("" + a[i]).length)));
return t
},
getIOS: function() {
var e = navigator.userAgent,
t = (navigator.appVersion, e.indexOf("Android") > -1 || e.indexOf("Linux") > -1),
a = !!e.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
return ! t && !!a
},
getBirthdayByIdCard: function(e) {
if ((0, i.isIdCard)(e)) {
var t = void 0;
return 15 == e.length ? (t = e.substring(6, 12), t = "19" + t, t = t.substring(0, 4) + "-" + t.substring(4, 6) + "-" + t.substring(6)) : (t = e.substring(6, 14), t = t.substring(0, 4) + "-" + t.substring(4, 6) + "-" + t.substring(6))
}
},
getSexByIdCard: function(e) {
if ((0, i.isIdCard)(e)) return parseInt(e.substr(16, 1)) % 2
},
decimal: function(e, t) {
var a = 100;
return t && (a = t),
isNaN(e) ? (0).toFixed(2) : isNaN(a) ? parseFloat(e).toFixed(2) : (parseFloat(e) / a).toFixed(2)
},
DisableScroll: function(e, t) {
function a(e) {
e.preventDefault()
}
var i = t && document.querySelector(t) || "";
e ? n.
default.on(i || document, "touchmove", a) : n.
default.off(i || document, "touchmove", a)
},
getConvertWeek: function(e) {
return e ? "周" + ["日", "一", "二", "三", "四", "五", "六"][new Date(e).getDay()] : ""
},
n: function(e) {
return e < 10 ? "0" + e: "" + e
}
};
e.exports = c
},
494 : function(e, t, a) {
e.exports = a.p + "images/ex.2fc931a3338f0a26b86234e81e07b8de.jpg"
},
539 : function(e, t) {},
540 : function(e, t, a) {
e.exports = a.p + "images/top-bg.431bab5276344ecd35c27566b74d215b.png"
}
});
发下h5的页面链接看看。
要点“语音介绍”