问题
I have a typescript/javascript Tizen Web App running in a Samsung Smart TV Emulator v5.0. Using the Samsung AVPlay API. The web app plays an MPEG streaming video source from an HDHomeRun device. The video plays perfectly with sound.
The problem is, none of the playhead changing functions work. i.e seek
, jumpBackward
, jumpForward
etc. The all give me the same error "InvalidStateError: PLAYER_ERROR_INVALID_STATE" even though the state is valid "PLAYING, PAUSED or READY".
Here is a code snippet:
var state = webapis.avplay.getState();
console.log("[Player][seekBackward] state: ", state);
webapis.avplay.jumpBackward(5000, success =>
{
console.log("[Player][rewind][success]");
}, error =>
{
console.error("[Player][seekBackward]", error);
});
Here is the resulting error in the console when I call this:
Any ideas on what can I can do to get the jumpBackward
and other playhead functions to work?
回答1:
I checked: with AVPlay wgt , with the URL [http://168.219.241.217/fileshare/AVPlayTest/WebAPITest/Basic/Youtube.mp4] , seek and jumpfw functionality working fine. but above url internal to samsung, i think that is not accessible outside samsung.
I didn't meet the problem as you, but basing on my experience you should check:
- problem 1,may possible with different content , it may related to specific content. its better if get played content url and wgt used, please attach if possible.
回答2:
var state = webapis.avplay.getState();
console.log("[Player][seekBackward] state: ", state);
if (state == "PLAYING" || state == "PAUSED")
{
webapis.avplay.jumpBackward(5000, success =>
{
console.log("[Player][rewind][success]");
}, error =>
{
console.error("[Player][seekBackward]", error);
});
}
Try this, you must check player state(PLAYING or PAUSED) before forward and rewind media.
It may be helpful for you.
来源:https://stackoverflow.com/questions/58548191/unable-to-change-the-playhead-location-using-samsung-avplay-api