how to use the method changeToMediaAtIndex in the tvmlkit js to change video in the playlist? When i use this method with the player class (player.changeToMediaAtIndex(2)) nothing happened...
how to use method changeToMediaAtIndex tvmlkit js
330 Views Asked by Vassilis A. Alexiou At
1
There are 1 best solutions below
Related Questions in TVOS
- shouldWaitForLoadingOfRequestedResource delegate method not getting called
- AVPlayerViewController's caption options do not update in .Net 8 tvOS app
- ReplayKit tvOS issue
- EXPO React-Native: expo-sqlite compile error on TVOS 17.0
- onRequestClose() method does not get called from react-native-modal
- tvOS - UICollectionViewCompositionalLayout & NSLayoutConstraint issue
- AVPlayer:While playing DRM video, sometimes the audio and video both are not visible but the seek bar continues progress
- Unity build app for both tvOS and iOS in a single Xcode project
- tvOS: Universal Links Handling in Media App
- Custom back button added as overlay to AVPlayercontroller not clickable in tvos
- Back button in react-native-tvos
- tvOS and NavigationSplitView not working properly
- tvOS - inputView on UITextfield does not work
- Getting Swift_header compilation error for tvOS
- AVPlayerviewcontroller Voice Over Accessibility
Related Questions in TVML
- TVOS TVML XMLHttpRequest memory leak crashes application
- tvML, can't get player to repeat, mediaItemWillChange doesn't fire?
- Bitrate in TVMLKit JS media player
- TVML resumable player (in tvOS 14)
- TVML & database
- TVJS player in Apple TV misfiring the event mediaItemDidChange in tvOS14 beta version
- is there a way to use glyphs in a tvml menubar?
- How to include HTML5 based games in tvOS custom apps?
- Overlay, Search functionality in TVML App
- Which template to use for tabular data in TVML?
- Search Functionality in IOS TVML application
- Way to handle/catch video streaming error and redirect in tvOS TVML
- How should I map tvOS AppDelegate's applicationWillEnterForeground to a javascript function?
- How to detect that a TVML lockup loses focus?
- How to speed up UICollectionView cell rendering in tvOS
Related Questions in TVOS10
- UIUserInterfaceStyle reverting to UIUserInterfaceStyleDark on each reopen
- tvOS 11 update UICollectionView Crash
- Change background of fullscreen keyboard TVOS app
- tvOS - playPause Gesture not working
- tvOS 11 display issue
- Scroll in UIScrollView with tvOS
- Define next object after swipe in tvOS
- How to play url video using AVPlayerViewController
- Settings.bundle not respecting app group for shared NSUserDefaults on tvOS
- custom apple tvOS app crashes after a few days
- setSemanticContentAttribute: not working in tvOS 10
- build TVOS Example App with React Native using github.com/douglowder/react-native-appletv build errors
- Charles Proxy capture tvOS 10.2?
- Since tvOS 10.2 the Apple TV displays a Airplay connection requires iOS 7.1 or later error
- Video Download in Apple tvOS
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
I was having issues with this too. My code looked like this.
I would call play and immediately call to change the media item. I tried different ordering (calling play after changing the item) and I noticed that when I stepped through the code, it would work as intended. Note that
this.startingVideoIdis set on the controller by an action before calling the play function that contains the above code.videoItemsListis also defined above and has Object's with the video information.I decided to add an event listener and wait until I received an event from the player before trying to change the currentItem. I removed
player.changeToMediaAtIndex(this.currentMediaItemIndex);from the play function and moved it into the event listener.I added the event listener into the play function when the player is created like so.
Then I implemented the event listener to check the playlist and see if it is playing the right video when it goes into a playing state.
This works great now and always starts from the right location. You will need additional state tracking with event listeners, like changing the currentMediaItemIndex when the track changes, but this should get you on the right track I hope.
There still isn't a lot of good tvos answers on here yet. Hopefully this will help.
Happy programming.