shiyiya / oplayer

:zap: Another HTM5 video player.

Home Page:https://oplayer.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When subtitle default is true it does not show

MuhammadTufailAli opened this issue · comments

I am using subtitle in Oplayer.
Following is my code
.use(
[
ui({
theme: { primaryColor: "#D98420" },
coverButton: true,
pictureInPicture: false,
miniProgressBar: false,

            controlBar: false, //chrome cast ko uper la k jana k lia
            //subtitle are added
            subtitle: {
              color: "white",
              fontSize: 24,
              fontWeight: 700,
              fontFamily: "Roboto",
              background: true,
              source: [
                {
                  name: "English",
                  default: true,
                  src: MediaToPlay?.srt_file,
                },
              ],
            },


          hls({ forceHLS: true }),

          // chromecast,
          conditionToChromeCast && otherBrowser && chromecast,
        ].filter(Boolean)
      )
      
      When subtitle    default: true, then it does not show but if i do    default: false and then enable it manually subtitle starts showing. Please help me resolve this issue

i console my Oplayer when it was created
My currentSubtitle is
{
"name": "English",
"default": true,
"src": "https://streambe1.nayatel.com/movies/Navalny.1080p-HD.srt"
}
but
isShow:false

If i reload page then isShow gets true why is this behaviour

commented

pls upload srt file

Upload srt file where i don't understand what you said. Can you please explain?

I also added my movie link and srt link in Oplayer playground it is also not showing over there

My code
const player = Player.make("#app", {
// isLive: true,
source: {
src: "https://5c7da495a96a8.streamlock.net/vodedge/_definst_/http/movies/Navalny.1080p-HD.mp4/playlist.m3u8",
poster: "https://ohplayer.netlify.app/poster.png",
title: "君の名は"
},
autoplay: true,
videoAttr: {
// crossOrigin: "anonymous"
}
})
.use([
ui({
subtitle: {
background: true,
source: [
{
name: "Japanese",
default: true,
src: "https://streambe1.nayatel.com/movies/Navalny.1080p-HD.srt"

      },
      {
        name: "CH & JP",
        src: "https://ohplayer.netlify.app/君の名は.srt"
      }
    ]
  },
  
 If i reload then subtitles starts showing and if i make subtitle default:false and manually open it then its start showing
commented

source cannot access

So what should i do

i also added Oplayer playground src
{
name: "Japanese",
default: true,
src: "https://ohplayer.netlify.app/君の名は-jp.srt"
}

      But it is also now showing if default: true,

Please give me solution

Yes above is working fine but in my case subtitle are not showing
Can you please use movie src as
https://5c7da495a96a8.streamlock.net/vodedge/_definst_/http/movies/Navalny.1080p-HD.mp4/playlist.m3u8
and use following subtitle
https://streambe1.nayatel.com/movies/Navalny.1080p-HD.srt
and check if subtitle show or not
In this way we will check where problem exists?

commented

Unable to access your resources and subtitle files

commented

No time this week, looking at it next week, provide your srt file

Same issue on @oplayer/ui": "1.2.34-beta.1 & Chrome 117.0.5938.149 (Official Build) (x86_64)

commented

Same issue on @oplayer/ui": "1.2.34-beta.1 & Chrome 117.0.5938.149 (Official Build) (x86_64)

reproduction repo?

Same issue on @oplayer/ui": "1.2.34-beta.1 & Chrome 117.0.5938.149 (Official Build) (x86_64)

reproduction repo?

Not yet. but I just got workaround this problem.
image

commented

Same issue on @oplayer/ui": "1.2.34-beta.1 & Chrome 117.0.5938.149 (Official Build) (x86_64)

reproduction repo?

Not yet. but I just got workaround this problem. image

所以只是写法错了。

image

差不多, 我感觉和这个src 有关系

image

很奇怪, 如果用之前的写法刚刷新页面进去第一次是ok的, 然后重新加载oplayer就挂了

image

这两cues都没了

commented

切换视频源会重建cue
重新加载是怎么个加载法?

I am using subtitle in Oplayer.
Following is my code
.use(
[
ui({
theme: { primaryColor: "#D98420" },
coverButton: true,
pictureInPicture: false,
miniProgressBar: false,

        controlBar: false, //chrome cast ko uper la k jana k lia
        //subtitle are added
        subtitle: {
          color: "white",
          fontSize: 24,
          fontWeight: 700,
          fontFamily: "Roboto",
          background: true,
          source: [
            {
              name: "English",
              default: true,
              src: MediaToPlay?.srt_file,
            },
          ],
        },


      hls({ forceHLS: true }),

      // chromecast,
      conditionToChromeCast && otherBrowser && chromecast,
    ].filter(Boolean)
  )
  
  When subtitle    default: true, then it does not show but if i do    default: false and then enable it manually subtitle starts showing. Please help me resolve this issue

我代码是放在vue的onMounted 里面的, 重新加载大概就是...关了vue这个页面,再打开.

onMounted(() => {
  emit('load');
  const player = Player.make('#oplayer', {
    source: {
      poster: webdav_thumbnail_link(props.selection.item),
      title: props.selection.item.basename,
    }
  }).use([
    ui({
      controlBar: { back: "always" },
      fullscreen: true,
    }),
    hls({
      forceHLS: true,
      withBitrate: true,
      active(instance, lib) {
        instance.on(lib.Events.MANIFEST_PARSED, (...payload) => {
          console.log(payload);
        });
      }
    }),
    dash({
      withBitrate: true,
      active(instance, lib) {
        instance.on("streamInitialized", (payload) => {
          console.log(payload);
        });
      }
    }),
    mpegts(),
  ]).create()

  fetch(...).then(() => {
    player.changeSource({
       src: videoUrlList[0].value,
       poster: webdav_thumbnail_link(props.selection.item),
       title: props.selection.item.basename,
    })
    player.context.ui.subtitle.changeSource(subtitleUrlList)
  })
})

subtitle

Look Even i used default: true, but when player is made the subtitle does not show and in console isShow is false

If i reload this page then isSHow get true and also if i do default: false and then manually turn on sutitle it works fine

commented

@eritpchy changeshource -》 changesubtitle

MediaToPlay?.srt_file
Try this. type: 'srt'

{
  name: "English",
  default: true,
  src: MediaToPlay?.srt_file,
  type: 'srt',
},

@eritpchy 关页面重新拿不应该啊

哈哈哈, 可能就是加载视频然后再加载字幕太快了导致的吧

@eritpchy changeshource -》 changesubtitle

我搜索了下代码, 没有changesubtitle这个方法吧

@eritpchy i also tried to do this but still in console i get isShow:false why this wired behavior?

"@oplayer/ui": "^1.2.32",
My ui version

"@oplayer/ui": "^1.2.32", My ui version

Maybe you should upgrade to @oplayer/ui": "1.2.34-beta.1 ?

Is it working fine in 1.2.34?

Not sure..

commented

Are you using oplayer, may i put it in oplayer readme?

Who use OPlayer?

  • NGEWIBU.TV : Nonton Anime Sub Indo | Nonton Anime Subtitle Indonesia Gratis
  • Animex : Watch Anime for free in HD quality with English subbed or dubbed.
  • UPV : free animes no ad
  • Feel free to submit yours in Let me know!

@shiyiya 还没发布, 且太小众, 都不好意思了😅

commented

@shiyiya 还没发布, 且太小众, 都不好意思了😅

那就点个star先 🤣

commented

"@oplayer/ui": "^1.2.32", My ui version

try upgrade all oplayer

npm update @oplayer/core @oplayer/ui @oplayer/xxx

Okay i hope nothing will crash after that 🤣

i updated my Oplayer all dependencies now my "@oplayer/ui": "^1.2.32", But still subtitle is not showing. Still isShow is false. Why it is still not resolved

commented

1.2.34-beta.2

npm i @oplayer/ui@1.2.34-beta.2

commented

close,no respond

Are you using oplayer, may i put it in oplayer readme?

Who use OPlayer?

  • NGEWIBU.TV : Nonton Anime Sub Indo | Nonton Anime Subtitle Indonesia Gratis
  • Animex : Watch Anime for free in HD quality with English subbed or dubbed.
  • UPV : free animes no ad
  • Feel free to submit yours in Let me know!

https://github.com/eritpchy/aliyundrive-webdav/releases
已经发布, 用了你的oplayer😃