video ,h5,苹果手机播放没有声音

            <div class="video-box" v-if="details.type == 'video'">
                <!-- <img src="../../assets/images/index/play.png"  class="video-box-play" alt="" @click="initVideo"/> -->
                <!-- <video width="100%" height="100%" class="video-js vjs-big-play-centered vjs-fluid" 
                 controls  preload="auto" id="myVideo"
                 :poster="details.poster_url" 
                 > -->
                  <video width="100%" height="100%" class="video-js vjs-big-play-centered vjs-fluid" 
                 controls  
	             id="myVideo" 
                 :poster="details.poster_url" 
	             x5-video-player-fullscreen="true" webkit-playsinline="true" x-webkit-airplay="true" playsinline="true"
                 x5-playsinline 
	             preload="auto"
                 >	
                    <source type="video/mp4" v-if="details.video_type=='local'" :src="details.video_url"/>
                    <source type="video/mp4" v-else-if="details.video_type=='link'" :src="details.video_source_url"/>
                </video>

            </div>
updated(){
    if(this.details.type == 'video'){
        this.initVideo();
    }
},
         initVideo() {
            this.$nextTick(() => {
            let myPlayer = this.$video(document.getElementById('myVideo'), {
                // //确定播放器是否具有用户可以与之交互的控件。没有控件,启动视频播放的唯一方法是使用autoplay属性或通过Player API。
                // controls: true,
                // //自动播放属性,muted:静音播放
                // autoplay: false,
                // //建议浏览器是否应在<video>加载元素后立即开始下载视频数据。
                // preload: "auto",
                // //设置视频播放器的显示宽度(以像素为单位)
                // //设置视频播放器的显示高度(以像素为单位)
                // controlBar:{
                // playToggle:true
                // }
//确定播放器是否具有用户可以与之交互的控件。没有控件,启动视频播放的唯一方法是使用autoplay属性或通过Player API。
				controls: true,
                autoDisable: true,
                
     //自动播放属性,muted:静音播放
                autoplay: false,
                //建议浏览器是否应在<video>加载元素后立即开始下载视频数据。
                preload: "auto",
                //设置视频播放器的显示宽度(以像素为单位)
				//设置视频播放器的显示高度(以像素为单位)
				language: 'zh-CN',
                notSupportedMessage: '此视频暂时无法播放',
                    controlBar:{
                	playToggle:true
				},	

            }); 
            })
        },
<template>
    <div>
            <div class="video-box" v-if="details.type == 'video'">
                <!-- <img src="../../assets/images/index/play.png"  class="video-box-play" alt="" @click="initVideo"/> -->
                <!-- <video width="100%" height="100%" class="video-js vjs-big-play-centered vjs-fluid" 
                 controls  preload="auto" id="myVideo"
                 :poster="details.poster_url" 
                 > -->
                  <video width="100%" height="100%" class="video-js vjs-big-play-centered vjs-fluid" 
                 controls  
	             id="myVideo" 
                 :poster="details.poster_url" 
	             x5-video-player-fullscreen="true" webkit-playsinline="true" x-webkit-airplay="true" playsinline="true"
                 x5-playsinline 
	             preload="auto"
                 >	
                    <source type="video/mp4" v-if="details.video_type=='local'" :src="details.video_url"/>
                    <source type="video/mp4" v-else-if="details.video_type=='link'" :src="details.video_source_url"/>
                </video>

            </div>
	    <div class="main">
            <div class="navs">
                <div class="nav-title" style="color:#333;">{{details.title}}</div>
                <div class="nav-con">
                    <div class="nav-time">{{details.published_time}}</div>
                    <!-- <div class="nav-see">
                        <img src="../../assets/images/index/see.png" class="nav-see-img" alt="" />
                        {{details.hits}}
                    </div> -->
                </div>
            </div>
             
            <div class="nav-head">
                <router-link :to='"/Doctor/"+ details.doctor.user.id'> 
                <div style="display: flex; align-items: center;">
                    <div class="li-nav-head">
                        <!-- <van-image  lazy-load  radius='82px' class="li-nav-head-img" src="https://cn.bing.com/th?id=OHR.WhirlpoolFinland_ZH-CN6473757145_UHD.jpg&rf=LaDigue_UHD.jpg&pid=hp&w=1920&h=1080&rs=1&c=4" /> -->
                        <van-image  lazy-load  radius='82px' class="li-nav-head-img" :src="details.doctor.work_img?details.doctor.work_img:''" />
                        <img class="li-nav-head-V" src="../../assets/images/index/tips.png" alt="">
                    </div>
                    <div class="li-nav-title">
                        <div class="li-nav-name">
                            {{details.doctor.name}}
                        </div>
                        <p class="li-nav-text">{{details.doctor.hospital?details.doctor.hospital.name:""}} {{details.doctor.job_title?details.doctor.job_title.name:""}}</p>
                    </div>
                </div>
                </router-link>
                <div class="li-nav-follows" v-if="!details.doctor.is_followed" @click="Followeds(details.doctor.is_followed,details.doctor.user.id)">+ 关注</div>
                <div class="li-nav-follows iSfollows" v-else @click="Followeds(details.doctor.is_followed,details.doctor.user.id)">已关注</div>
            </div>
             
            <div class="content" v-html="$options.filters.replaces(details.body)"></div>
  
         
            <div class="list-nav" v-if="list.length !== 0">
                <div class="deGood-title list-nav-title" >文章</div>
                <!-- <p>更多  <Icon name="arrow" size='14' color='#999999' /></p> -->
            </div>
            <List iSdynamic :list='list' finishedText='' :paging='paging'  @Give='Give' v-if="paging.total"></List>
            <!-- <div class="more" v-if="list.length !== 0">查看更多<Icon name="arrow" size='18' color='#12bfd2'/></div> -->
            <div class="listDetailsAd" v-if='enable.enable==1'>
                <van-image  lazy-load   class="listDetailsAd-img" :src="enable.poster" />
            </div>
            <div class="empty"></div>
                      <div class="position">
                <div class="zan" @click="Give({id:details.id,status:details.is_liked,category:true})">
                    <img src="../../assets/images/index/zan.png" alt="" class="zan-img"  v-if='!details.is_liked'/>
                    <img src="../../assets/images/index/zans.png" alt="" class="zan-img" v-else/>
                    {{details.ups_num}}
                </div>
                <div class="zan" @click="Share">
                    <img src="../../assets/images/index/see.png" class="nav-see-img" alt="" />
                    {{details.hits}}
                </div>
            </div>
        </div>
        <router-link :to="{path:'/SelectedCases',query:{id:details.doctor.user.id}}">
        
            <div class="footer" v-if="details.doctor.consult_enable == 1" style="position:initial;" >
                <img src="../../assets/images/index/network.png" alt=""  class="footer-img"/>
                <!--  -->
                网络咨询
            </div>
        </router-link>
    </div>
</template>
<script>
import{ Image, Icon ,Toast,Dialog} from "vant"
import List from '../components/List'
import { Jssdk } from '../../api/jssdk';
import { getArticlesList, getGive, deleteGive, getArticlesDetails } from '../../api/home'
import { getSettings, } from '../../api/settings'
import { followed, cancelFollow, followingsList } from '@/api/follow'
var wx = require('weixin-js-sdk')
export default {
     components: { 'van-image':Image, Icon,List,},
     data(){
         return{
             id:0,
             details:{doctor:{hospital:{},user:{},job_title:{}}},
             listQuery:{
                sort:"popular",
                offset:0,
                limit:15
             },
             list:[],
             paging:{},
              show:true,
            mobile:"",
            text:"",
            enable:{},// 广告
         }
     },
     filters:{
    replaces(val){
         return val.replace(/\<img/gi, '<img style="max-width:100%;height:auto"')
        }
    },
     created(){
      this.$route.meta.title= ''
      this.Jssdks()
    },
    beforeRouteLeave(to, form, next) {
        this.$route.meta.title= ''
    next()
  },

    mounted(){
        this.id = this.$route.params.id
        // Dialog({message:JSON.stringify(location.href.indexOf("?"))+'00000000000'})
        // return
        this.getDetails(this.id)
        this.settings()
        
    },
    updated(){
        if(this.details.type == 'video'){
            this.initVideo();
        }
    },
     watch:{
         '$route'(to, from){
             this.id = to.params.id
             this.getDetails(this.id)
         },
     },
     methods:{
         // 关注按钮
         Followeds(status,id){
             if(!status){
                 // 关注
                 followed({user_id:id}).then(res=>{
                     if(res.followed){
                         this.details.doctor.is_followed= true
                     }else{
                         Toast('关注失败')
                     }
                 })
             }else{
                 // 取消关注
                 cancelFollow(id).then(res=>{
                     if(res.cancelFollow){
                         this.details.doctor.is_followed= false
                     }else{
                         Toast('取消关注失败')
                     }
                 })
             }
         },
         Jssdks(){
             let url = location.href.split('#')[0]
             console.log(url)
             Jssdk({url,}).then(res=>{
                 console.log(res)
                 const debug = res.debug
                 const appId = res.appId
                 const timestamp = res.timestamp
                 const nonceStr = res.nonceStr
                 const signature = res.signature
                 // const jsApiList = res.jsApiList
                 wx.config({
                     debug: debug, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
                     appId: appId, // 必填,公众号的唯一标识
                     timestamp: timestamp, // 必填,生成签名的时间戳
                     nonceStr: nonceStr, // 必填,生成签名的随机串
                     signature: signature, // 必填,签名
                     jsApiList: [
                         'checkJsApi',
                         'updateAppMessageShareData',
                         'updateTimelineShareData',
                         'onMenuShareAppMessage',
                         'onMenuShareTimeline']// 必填,需要使用的JS接口列表
                 })
                 wx.checkJsApi({
                     jsApiList:[
                         'updateAppMessageShareData',
                         'updateTimelineShareData',
                         'onMenuShareTimeline',
                         'onMenuShareAppMessage'
                     ],
                     success:(res)=>{
                         console.log(res)
                         // alert(JSON.stringify(res))   //这里没返应 也没提示,也不会进断点
                     }
                 });
                 wx.ready(function(ready){
                    //  console.log(this.details.title)


                     // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
                 });
                 wx.error(function(error){
                     console.log(error)
                     // Dialog.confirm({
                     //    message: error
                     // })
                     console.log('error')
                     // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
                 });
             })
         },
         // 分享
         Share(){


         },
         initVideo() {
            this.$nextTick(() => {
            let myPlayer = this.$video(document.getElementById('myVideo'), {
                // //确定播放器是否具有用户可以与之交互的控件。没有控件,启动视频播放的唯一方法是使用autoplay属性或通过Player API。
                // controls: true,
                // //自动播放属性,muted:静音播放
                // autoplay: false,
                // //建议浏览器是否应在<video>加载元素后立即开始下载视频数据。
                // preload: "auto",
                // //设置视频播放器的显示宽度(以像素为单位)
                // //设置视频播放器的显示高度(以像素为单位)
                // controlBar:{
                // playToggle:true
                // }
//确定播放器是否具有用户可以与之交互的控件。没有控件,启动视频播放的唯一方法是使用autoplay属性或通过Player API。
				controls: true,
                autoDisable: true,
                
     //自动播放属性,muted:静音播放
                autoplay: false,
                //建议浏览器是否应在<video>加载元素后立即开始下载视频数据。
                preload: "auto",
                //设置视频播放器的显示宽度(以像素为单位)
				//设置视频播放器的显示高度(以像素为单位)
				language: 'zh-CN',
                notSupportedMessage: '此视频暂时无法播放',
                    controlBar:{
                	playToggle:true
				},	

            }); 
            })
        },
        // 获取文章信息
         getDetails(id){
             window.scrollTo(0,0);
             let _this = this
             getArticlesDetails(id).then(res=>{
                 console.log('*************',res)
                 _this.details=res
                 // let noSharp = location.href.split('#')[0]
                 // let url = noSharp.includes('?') : `${noSharp}&shareId=1234` : `${noSharp}?shareId=1234`
                _this.$route.meta.title= res.title
                // this.$route.meta.title = value
                wx.updateAppMessageShareData({
                     title: res.title, // 分享标题
                     desc: res.simple_body || '大医谱爱,健康未来', // 分享描述
                     link:  location.href.split('#')[0] +'/#/ListDetails/'+res.id+"?status=true", // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
                     imgUrl: res.poster_url, // 分享图标
                     success: function () {
                         // Toast('///')
                         // 用户确认分享后执行的回调函数
                         // alert('share successful');
                     },
                     cancel: function () {
                         // Toast('/')
                         // 用户取消分享后执行的回调函数
                         // alert('share cancel');
                     }
                 })
                 wx.updateTimelineShareData({
                     title: res.title, // 分享标题
                     desc: res.simple_body || '大医谱爱,健康未来', // 分享描述
                     link: location.href.split('#')[0] +'/#/ListDetails/'+ res.id +"?status=true",// 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
                     imgUrl: res.poster_url, // 分享图标
                     success: function () {
                         // Toast('///')
                         // 用户确认分享后执行的回调函数
                         // alert('share successful');
                     },
                     cancel: function () {
                         // Toast('/')
                         // 用户取消分享后执行的回调函数
                         // alert('share cancel');
                     }
                 })

                 _this.listQuery.doctor_user_id = res.doctor.id
                 // 医生的文章
                 getArticlesList(_this.listQuery).then(response=>{
                     console.log(response)
                     _this.list=response.data
                     _this.paging = response.paging
                 })
             })
         },
         //  列表点赞
            Give(obj){
                if(!obj.status){
                getGive(obj.id).then(res=>{
                    console.log(res)
                    if(res.success){
                        if(obj.category){
                            this.details.is_liked = true
                            this.details.ups_num = this.details.ups_num + 1
                        }else{
                            let list = this.list
                            for(let i in list){
                                if(list[i].id == obj.id){
                                list[i].is_liked = true
                                list[i].ups_num = list[i].ups_num+1
                                }
                            }
                            this.list=list
                        }
                    }
                })
                }else{
                deleteGive(obj.id).then(res=>{
                    if(res.success){
                        if(obj.category){
                            this.details.is_liked = false
                            this.details.ups_num = this.details.ups_num - 1 < 0 ? 0 : this.details.ups_num - 1 
                        }else{
                           let list = this.list
                            for(let i in list){ 
                                if(list[i].id == obj.id){
                                list[i].is_liked = false
                                list[i].ups_num = list[i].ups_num - 1 < 0 ? 0 :list[i].ups_num - 1
                                }
                            }
                            this.list=list
                        }
                    }
                })
                }
            },
         // 获取广告
         settings(){
             getSettings('articleAdvert').then(res=>{
                 console.log(res)
                 this.enable=res
             })   
         }
     },
}
</script>
<style lang="css">
.video-js .vjs-big-play-button{
    width: 102px !important;
    height: 102px !important;
    border-radius: 50% !important;
    line-height: 92px !important;
}
.vjs-big-play-centered .vjs-big-play-button{
    margin-top: -51px!important;
    margin-left: -51px !important;
}
</style>
<style scoped>

@import url('../../assets/css/listDetails.css');
 @import url("../../assets/css/doctor.css");


</style>
安卓手机无法播放H5视频有可能是因为以下几个原因: 1. 网络连接问题:如果您的安卓手机网络连接不稳定或者速度较慢,可能会导致H5视频无法缓冲或加载。您可以尝试切换到更稳定的网络环境或者重新连接网络进行尝试。 2. 浏览器兼容性问题:不同的安卓手机可能使用不同的浏览器,默认的浏览器对H5视频的支持程度也有所不同。您可以尝试更换不同的浏览器,或者更新您当前使用的浏览器版本。 3. 缺少相关插件:有些H5视频可能需要特定的插件才能播放,如果您的安卓手机缺少这些插件,可能导致视频无法正常播放。您可以尝试安装或更新相关插件,比如Flash插件或者H5视频播放器。 4. 视频格式不支持:某些安卓手机可能对特定的视频格式支持不好,如果您尝试播放H5视频使用了不被支持的视频格式,可能导致无法播放。您可以尝试找到其他相同内容但是使用支持的视频格式的视频进行播放。 5. 设备硬件问题:如果您的安卓手机硬件配置较低,比如运行内存不足或者处理器性能较差,可能无法正常播放大尺寸或高清晰度的H5视频。这种情况下,您可以尝试调整视频质量或者尝试使用其他设备进行播放。 总结起来,安卓手机无法播放H5视频可能是由于网络连接问题、浏览器兼容性问题、缺少相关插件、视频格式不支持或设备硬件问题所致。您可以依次排查这些可能原因,尝试解决问题。如果问题仍然存在,建议咨询相关技术支持或者尝试其他解决方案。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值