WeChat applet realizes video number jump

Three types:

1. Jump to the home page of the video account ------ must be the same subject

Call functions

wx.openChannelsUserProfile({
   finderUserName: '' //视频号id
})

2. Use embedded ------ must be the same subject

use

//需要视频id和视频号id,使用wx:if是因为不做组件销毁的话,会先报该视频无法加载在正常显示
//item--是我们需要的视频数据,根据个人情况来定
<channel-video style="width:100%;height:100vh;" wx:if="{
    
    { item }}"   muted="{
    
    { false }}" object-fit="{
    
    { contain }}" autoplay="{
    
    { true }}"  feed-id="{
    
    { item.videoId }}" finder-user-name="{
    
    { item.videoAccountsId }}"></channel-video>
There are disadvantages: the poster image cannot be set, the default image is the first frame of the video, and the image will be stretched. (I haven't found a good solution so far. If you have a friend who knows the method, I hope to leave a message below)

3. Jump to the video number video ------ does not need to be the same subject

Call functions

wx.openChannelsActivity({
    feedId: '',//视频id
    finderUserName: '',//视频号id
    fail(error){
         console.log(error)
    }
})

Guess you like

Origin blog.csdn.net/qq_41687299/article/details/129622018